-
Notifications
You must be signed in to change notification settings - Fork 0
React Component Lifecycle methods
sameeri edited this page Feb 2, 2015
·
1 revision
When a component is asked to be rendered,
- React fetches the component definition
- Instantiates the class. This is a JavaScript object, a Virtual DOM representation.
- Mounts it on the actual DOM.
- Any updates are observed and rerendering happens.
To manage the component, in the life cycle of a component, React provides three classes of interfaces for the developer.
Mounting
Updating
Unmounting
The following are the methods in each class.
Lifecycle method | one time invocation | called during initial render |
---|---|---|
componentWillMount | Yes | Yes |
componentDidMount | Yes | Yes |
Lifecycle method | one time invocation | called during initial render |
---|---|---|
componentWillRecieveProps | No | No |
shouldComponentUpdate | No | No |
componentWillUpdate | No | No |
componentDidUpdate | No | No |
Lifecycle method | one time invocation | called during initial render |
---|---|---|
componentWillUnMount | Yes | No |