javascript - Set ReactJS state asynchronously -
If you perform an asynchronous action which converts state to componentWillMount
(such as Docs ), But that component has been unmounted (user has navigated) before the async call is complete, now you are trying to set the state with unmountable callback on unmounted components, and one
"Invoire violation: Replacement (...): Only a mount or mounting component The date can. "
error.
What's the best way around this?
Thank you.
Update 2016
Perhaps the best solution for problems arising from the async call from How to solve this problem properly and how to use not is mounted here: isMounted < Do not start using / code> because it will be removed from the response.
cmomponentWillMount
is to move things to componentDidMount
.
Comments
Post a Comment