Correct use of DOM with react.js

5

Knowing that ReactJS uses a virtual DOM where elements are rendered in a DOM representation in memory so that all changes are made faster then it would be "wrong" to use findDOMNode to directly access a DOM element and manipulate your state?

    
asked by anonymous 23.07.2015 / 04:27

1 answer

6

Yes, it would be wrong.

findDOMNode exists only for reading DOM information (ex: position, value of form fields, etc.). Modifying DOM directly can also cause inconsistencies, because the view that framework has DOM (virtual-dom) will not be the same as DOM in the browser, so it may end up overwriting the values you set manually. >     

23.07.2015 / 04:45