convert-text-to-react
Advanced tools
Comparing version
{ | ||
"name": "convert-text-to-react", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "プレーンテキストをReactに変換する", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -13,7 +13,13 @@ # convert-text-to-react | ||
import * as ReactDOM from "react-dom/server"; | ||
import { toJSX, convert } from "convert-text-to-react"; | ||
import { toJSX, convert, ExampleComponent } from "convert-text-to-react"; | ||
const inputText = "<CustomComponent x={1} y={-20}>Result of multiplication:</CustomComponent>"; | ||
const inputText = "<ExampleComponent x={1} y={-20}>Result of multiplication:</ExampleComponent>"; | ||
const components = { | ||
ExampleComponent, | ||
} | ||
const jsxText = toJSX(inputText); | ||
const value = convert(jsxText!); | ||
const converter = createConverter(components); | ||
const value = converter(jsxText!); | ||
@@ -20,0 +26,0 @@ console.log(ReactDOM.renderToStaticMarkup(value);) |
Sorry, the diff of this file is not supported yet
172214
0.05%36
20%