Which lifecycle method is called during the unmounting phase in class components?
The componentWillUnmount lifecycle method is called during the unmounting phase in class components. This method is invoked immediately before a component is unmounted and destroyed. It's the ideal place to perform cleanup tasks like invalidating timers, canceling network requests, or cleaning up subscriptions to prevent memory leaks.