context (any)
props (Readonly<object> & Readonly<object>)
refs (object)
state (Readonly<any>)
render(): Element
setState(state: function | S | object, callback: function): void
forceUpdate(callBack: function): void
componentDidMount(): void
Called immediately after a compoment is mounted. Setting state here will trigger re-rendering.
shouldComponentUpdate(nextProps: Readonly<object>, nextState: Readonly<any>, nextContext: any): boolean
Called to determine whether the change in props and state should trigger a re-render.
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
.
componentDidCatch(error: Error, errorInfo: ErrorInfo): void
Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.
getSnapshotBeforeUpdate(prevProps: Readonly<object>, prevState: Readonly<any>): SS | null
Runs before React applies the result of render
to the document, and
returns an object to be given to componentDidUpdate. Useful for saving
things such as scroll position before render
causes changes to it.
componentDidUpdate(prevProps: Readonly<object>, prevState: Readonly<any>, snapshot: SS): void
Called immediately after updating occurs. Not called for the initial render.
componentWillMount(): void
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
UNSAFE_componentWillMount(): void
Called immediately before mounting occurs, and before Component#render
.
Avoid introducing any side-effects or subscriptions in this method.
componentWillReceiveProps(nextProps: Readonly<object>, nextContext: any): 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.
UNSAFE_componentWillReceiveProps(nextProps: Readonly<object>, nextContext: any): 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.
componentWillUpdate(nextProps: Readonly<object>, nextState: Readonly<any>, nextContext: any): void
Called immediately before rendering when new props or state is received. Not called for the initial render.
UNSAFE_componentWillUpdate(nextProps: Readonly<object>, nextState: Readonly<any>, nextContext: any): void
Called immediately before rendering when new props or state is received. Not called for the initial render.