(method) Yourcomponent.componentWillMount(): void
Called immediately before mounting occurs, and before Component#render. Avoid introducing any side-effects or subscriptions in this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
(method) Yourcomponent.componentDidMount(): void
Called immediately after a compoment is mounted. Setting state here will trigger re-rendering.
(method) Yourcomponent.componentWillReceiveProps(): void
Called when the component may be receiving new props. React may call this even if props have not changed, so be sure to compare new and existing props if you only want to handle changes.
Calling Component#setState generally does not trigger this method.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
(method) YourComponent.shouldComponentUpdate(nextProps: any, nextState: any): boolean
Called to determine whether the change in props and state should trigger a re-render.
Component always returns true. PureComponent implements a shallow comparison on props and state and returns true if any props or states have changed.
If false is returned, Component#render, componentWillUpdate and componentDidUpdate will not be called.
(method) Yourcomponent.componentWillUpdate(prevProps: any, prevState: any): boolean
Called immediately before rendering when new props or state is received. Not called for the initial render.
Note: You cannot call Component#setState here.
Note: the presence of getSnapshotBeforeUpdate or getDerivedStateFromProps prevents this from being invoked.
(method) Yourcomponent.componentDidUpdate(): void
Called immediately after updating occurs. Not called for the initial render.
The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
(method) Stations.componentWillUnmount(): void
Called immediately before a component is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.