D
D
Danil Chekalin2015-07-14 20:45:36
React
Danil Chekalin, 2015-07-14 20:45:36

React after unmount component does not remove it from memory?

React-route is used.
There are "main" and "another" routes.
When the "main" route starts, the MainComponent is mounted.
When the "another" route is started, AnotherComponent is mounted.
The module that describes AnotherComponent imports another SubModuleState module.
SubModuleState is the storage that the components in the AnotherComponent hierarchy will fill/modify.
After we worked on the another route and changed its state during the strorage process, we go to main, then back to another. And it would seem (to me) that AnotherComponent after dismantling should have been destroyed from memory, and as a result, SubModuleState was destroyed, which only components in the AnotherComponent hierarchy could refer to, but when switching back to another, SubModuleState has the last set state.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question