Comparation
Class Component | Function Component |
---|---|
constructor | Function components don’t need a constructor. You can initialize the state in the |
getDerivedStateFromProps | Schedule an update while rendering instead. |
shouldComponentUpdate | See |
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