DEV Community

Discussion on: How to use componentWillUnmount with Functional Components in React

Collapse
 
ankitalphaq profile image
Ankit Kumar Gupta

Hey, do we have some restrictions with using the current state values inside ComponentWillUnmount cleanup function ?
Few of my state values are reseted before my code could run 😔

Collapse
 
robmarshall profile image
Robert Marshall

Able to give a bit more context? If you are passing this state out of the component (e.g. to a parent) and then unmounting this component I imagine you would have problems.