L
L
lexstile2020-12-18 18:29:15
JavaScript
lexstile, 2020-12-18 18:29:15

How to make substring replacements in a string using html markup in react?

I found one option in the dock, but they themselves write - it's better not to use it, can it be implemented somehow differently?
We do not know in advance how many matches, performance is also a priority.

dangerouslySetInnerHTML={{
                    __html: option.name.replace(searchRegExp, `<span class="${cn(s.inputDropdown__match)}">$1</span>`),
                  }}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question