Problem Statement
What are lifecycle methods in React and why are they useful?
Explanation
Lifecycle methods manage setup and cleanup during a component’s life. Examples include componentDidMount, componentDidUpdate, and componentWillUnmount. Hooks like useEffect replace these.
Practice Sets
This question appears in the following practice sets: