K
K
KnightForce2017-04-23 16:50:58
React
KnightForce, 2017-04-23 16:50:58

React. Changes to an element via ref are taken into account?

If you change the DOM through ref - are the changes "valid"? So React won't fix on redraw etc.?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Gromov, 2017-04-24
@KnightForce

React only changes the DOM in places where there are differences after a new call to render. That is, if only 1 attribute has changed in the Virtual DOM that made up the new render call compared to the old call, then only this attribute will change. All other changes will be ignored by React. Therefore, if you do not change anything through ref, which is also calculated in render, then there will be no conflicts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question