https://github.com/himenon/convert-text-to-react
PlainテキストにReactのコンポーネントを適用させるサンプルコード
https://github.com/himenon/convert-text-to-react
function parser react typescript
Last synced: 2 months ago
JSON representation
PlainテキストにReactのコンポーネントを適用させるサンプルコード
- Host: GitHub
- URL: https://github.com/himenon/convert-text-to-react
- Owner: Himenon
- License: mit
- Created: 2018-12-02T18:29:50.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-04T06:31:57.000Z (almost 6 years ago)
- Last Synced: 2025-08-23T03:31:20.891Z (10 months ago)
- Topics: function, parser, react, typescript
- Language: TypeScript
- Homepage:
- Size: 82 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# convert-text-to-react
[](https://travis-ci.org/Himenon/convert-text-to-react)
# Usage
```sh
npm i convert-text-to-react
```
```ts
import * as ReactDOM from "react-dom/server";
import { convert, ExampleComponent } from "convert-text-to-react";
const rawText = "Result of multiplication:";
const components = {
ExampleComponent,
}
const result = convert(rawText, components);
console.log(ReactDOM.renderToStaticMarkup(result);
//
Result of multiplication: -20
```
# Licence
MIT
# Author
[Himenon](https://github.com/Himenon)