DefinitelyTyped/types/rehype-react/rehype-react-tests.tsx
Johan Fagerberg d01dbee933 [rehype-react] Add Fragment option, update which options are optional (#41600)
* [rehype-react] Add Fragment option

Usually this will be `React.Fragment`, but it accepts any component.

* [rehype-react] Update which options are optional

Most options have healthy defaults. Only `createElement` is required.

* [rehype-react] Update version number

* [rehype-react] Update tests to include Fragment option
2020-01-21 13:14:03 -08:00

20 lines
363 B
TypeScript

import React from "react";
import RehypeReact from "rehype-react";
const htmlAst = {
type: "element",
tagName: "button"
};
const { Compiler: compile } = new RehypeReact({
createElement: React.createElement,
Fragment: React.Fragment,
components: {
button: () => {
return <button />;
}
}
});
compile(htmlAst);