What are the three main phases of a component’s lifecycle?
Mounting, Updating, and Unmounting.
What is the purpose of the componentDidMount lifecycle method?
It’s invoked immediately after a component is inserted into the tree and is commonly used for fetching data or initializing subscriptions.
How can you replicate componentDidMount with hooks?
Using the useEffect hook with an empty dependency array: useEffect(() => { /* code here */ }, []).