Will the reaction convert the html fragments installed in the dangerous SetInnerHTML into a virtual DOM?

I use some DOM string processing libraries to generate an HTML string and then embed them in some React components using dangerouslySetInnerHTML in my project, is it responsive to add them to the virtual DOM? Can I get the benefits of React this way?

+6
source share
1 answer

Yes and no. They are presented in the form of string details, and the current html string as a whole is compared with the previous string using the equality operator.

Inside the lines there are no checks or html parsing in virtual dom. You can analyze html yourself or change the code that generates it to output virtual dom.

+5
source

Source: https://habr.com/ru/post/980062/


All Articles