I have a text such as
"This is my text Albert is my special word"
also I have a react component called SpecialWord I want to search through the text above and wrap all the special words in this case (Albert) with my SpecialWord Component
so the text above will output to something like this
This is my text <SpecialWord>Albert</SpecialWord> is my special word
after that I want to render the final result as a react component so something like this if possible
<div dangerouslySetInnerHTML={{__html: finalResult}}></div>
I already tried to get the start and end index of the special word and wrapped it with native html elements, when rendered it works fine since they are native html elements but I can't use the same approach with the SpecialWord component since it's not a native html elements