Is it necessary to call `unmountComponentAtNode` if the component's container is removed?

(Jeffrey Wear) #1

Hi folks, this is a mirror of a Stack Overflow question that has received an answer, but not an answer sufficiently informed by knowledge of React’s behavior IMO. The answer notes that old browsers may fail to garbage collect event handlers attached to unreachable DOM nodes, but what if I’m only supporting modern browsers?

IMO the question boils down to: does React keep any “global” references to handlers/state, if unmountComponentAtNode was not called? Otherwise the handlers/state would be unreachable after the DOM node had been removed was called, so I’d figure that the garbage collector would clean that stuff up.