facebook/react

Does instance stay instantiated after componentWillUnmount?

trusktr opened this issue · 5 comments

Or does that destroy the instance?

Can you give more information about what you mean?

@spicyj You know the instance of a component (f.e. the thing you can get by using this.refs.foo inside a component)? Do those get destroyed after their componentWillUnmount methods are called? Or do they stay alive to be re-used?

What do you mean by "destroyed"? All JavaScript objects are garbage collected when there are no more references.

Of course. I assume React lets go of the reference after calling it's componentWillUnmount. I jsut wanted to plan a way to keep some of my own objects alive across instantiations of news react components. I guess I'll make external singletons.

Yes, React never reuses an instance after it's been unmounted.