import { replaceReact } from "replace-react"; const MyApp = () => { return ( <div> {replaceReact("hello world", /(world)/g, (match, key) => ( <h1 key={key}>{match}</h1> ))} </div> ); };