string replace in react js code example
Example: how to replace strings with react components
import { replaceReact } from "replace-react";
const MyApp = () => {
return (
<div>
{replaceReact("hello world", /(world)/g, (match, key) => (
<h1 key={key}>{match}</h1>
))}
</div>
);
};