Comparation
Class Component
Function Component
constructor
Function components don’t need a constructor. You can initialize the state in the useState
call. If computing the initial state is expensive, you can pass a function to useState
.
getDerivedStateFromProps
Schedule an update while rendering instead.
shouldComponentUpdate
See React.memo
below.
render
This is the function component body itself.
componentDidMount
componentDidUpdate
componentWillUnmount
getSnapshotBeforeUpdate
There are no Hook equivalents for this method yet, but they will be added soon.
componentDidCatch
There are no Hook equivalents for this method yet, but they will be added soon.
getDerivedStateFromError
There are no Hook equivalents for this method yet, but they will be added soon.
Last updated