import { FC } from "react" ; function highlight ( text , regex ) { return regex ? text . replace ( regex , "<u class='text-primary'>$&</u>" ) : text ; } const HighlightedText = ( { text , regex , } ) => ( < span dangerouslySetInnerHTML = { { __html : highlight ( text , regex ) , } } />); export default HighlightedText ;