what is the life cycle
Referring to the various stages of the component from construction to remove it containe 3 parts
Mouting : when you components is first created and rendered onto the screen.
- constructor()
- render()
- componentDidMount()
useEffect(() => { //Mouting }, []);Updating : happens when your components state or props change.
- render()
- componentDidUpdate()
useEffect(() => { // your code }, [state]);Unmounting : when your components is removed from screen.
- componentWillUnmount()
useEffect(() => { // you code return ( //Unmounting ) }, [state]);