I achieved converting a piece of string into a component
function App() {
const text = "Please make sure this is BUTTON";
const modText = text.replace(/ /g, ", ");
const parts = modText.split(",");
const mapped = parts.map((part) => {
return part.match(/BUTTON/) ? <button>{part}</button> : part;
});
return <div>{mapped}</div>;
}
but the output in the image looks really weird when I combine it back
I wanted it to become one sentence again something like
just one sentence not with " " every word


join()the array to get a string.Please make sure this is[object Object]