Open hardfist opened 6 years ago
@hardfist are there any best practices regarding this? If componentWillUnmount doesn't fire, where would you normally free local state?
@drcmda normally you call createNamedContext in componentDidMount and call removeNamedContext in compoentWillUnmount,but if you really need use createNamedContext in constructor, your can free local state in componentWillMont on server side using environment detecting just like this https://github.com/jayphelps/react-observable-subscribe/issues/1
Great, thanks a lot, i will take a look after a nap. : )
store.js
namedContext.js
context.js
componentWillUnmount will not execute on server side, which cause providers increase rapidly with request increase and cause memory leak.