An open API service indexing awesome lists of open source software.

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のコンポーネントを適用させるサンプルコード

Awesome Lists containing this project

README

          

# convert-text-to-react

[![Build Status](https://travis-ci.org/Himenon/convert-text-to-react.svg?branch=master)](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)