const [text, setText] = useState("Type your text here"); const handleWord = (e) => { let searched = "your"; if (searched !== "") { let text2 = text; let re = new RegExp(searched,"gi"); // search for all instances let newText = text2.replace(re, `<stong>${searched}`); setText(newText); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)