3 ms·
You (and others) say that React can be introduced gradually, but then you say that it owns the DOM and is incompatible with JQuery unless you're careful. How ar
by andrewflnr 13y ago
You (and others) say that React can be introduced gradually, but then you say that it owns the DOM and is incompatible with JQuery unless you're careful. How are these reconciled? Can React manage only a subtree of the DOM and let JQ (et al) handle the rest?
- spicyj 13y agoYes. See my response here: https://news.ycombinator.com/item?id=6995262 https://news.ycombinator.com/item?id=6995262.
- kd5bjo 13y agoYes; you mount your top-level React component into a <div>, and React won't touch the DOM outside of that. It also provides hooks that get called throughout the lifecycle of each component, including whenever it's been added to or about to be removed from the DOM. These can be used to integrate non-React Javascript behaviors that want direct access to the DOM, but you still have to properly handle cleaning up when React wants to take your DOM node away.