React Text Replace
A package that makes replace jsx components content easier.
Install
NPM
- Use:
import { textReplace, TextReplace } from 'react-text-replace'
- Install:
npm install --save react-text-replace
YARN
- Use:
import { textReplace, TextReplace } from 'react-text-replace'
- Install:
yarn add react-text-replace
Usage
Basic Example
const App =
First Result
Hello >> world >> !!
Multiple Replaces Example
const source = ">> Hello >> world >> !!"const options =find: />>/{return<span style= fontSize: "2em" key=>$1</span>}find: /!!/{return <i key=>match</i>}var||
The Result Will Be
Hello >> world >> !!
Recursive Example With Caching
// Creates a cache that lasts until close the pageconst App =<TextReplacesource=">> Hello >> world >> !!"pipe=find: />>/{return<span style= fontSize: "2em" key=>$1</span>}isRecursive: truefind: /!!/{return <i key=>match</i>}/>
Will Result In
Helloworld!!
License
Licensed under permissive MIT license