componentWillUnmount
ComponentWillUnmount is a lifecycle method in React class components. It is invoked immediately before a component is unmounted and destroyed, giving the component a chance to perform any necessary cleanup.
The method is commonly used to release resources that were created when the component was mounted or
ComponentWillUnmount is not a place to start data fetching or to perform significant side effects. Instead,
In modern React development, functional components with hooks are often used instead of class components. The
Note that componentWillUnmount is not called during server-side rendering. It runs only in the client when