Q7: What are the main phases of the React component lifecycle?
The React lifecycle consists of three primary phases: Mounting (component creation and insertion into DOM), Updating (re-rendering due to state or props changes), and Unmounting (removal from DOM). Functional components handle these using hooks like useEffect.
Key Takeaways
Lifecycle phases: Mounting, Updating, and Unmounting.
Class lifecycle methods (
componentDidMount,componentWillUnmount) map touseEffectin functional components.
Knowledge Check
Which lifecycle cleanup method corresponds to returning a function from useEffect?