Inside a component (class extended from component class), define these functions.
The names are fixed and these will be called based on the life cycle event occured.
------------
lifecycle methods
---
inside component
componentDidMount(){
console.log("did mount called");
}
componentWillMount
componentWillReceiveProps(newProps)
shouldComponentUpdate(newProps, newState)
{
console.log('called the method');
return true;
}
componentWillUpdate(newProps, newState)
{
console.log('called the method');
}
componentDidUpdate(newProps, newState)
{
console.log('called the method');
}
componentWillUnmount
No comments:
Post a Comment