the components Lifecycle methods code example
Example 1: lifecycle methods react
Every component in React goes through a lifecycle of events. I like to think of them as going through a cycle of birth, growth, and death.
Mounting – Birth of your component
Update – Growth of your component
Unmount – Death of your component
Example 2: lifecycle method react
INITIALIZATION= setup props and state
MOUNTING= constructor->componentWillMount->render->componentDidMount
UPDATE= shouldComponentUpdate->componentWillUpdate->render
->componentDidUpdate
UNMOUNTING= componentWillUnmount