As we have learned in the previous chapters, we can use the useEffect Hook to model most of React's life cycle methods. However, if you prefer dealing with React life cycle directly, instead of using Effect Hooks, there is a library called react-hookedup, which provides various Hooks, including Hooks for the various React life cycles. Additionally, the library provides a merging State Hook, which works similarly to this.setState() in React's class components.
React life cycles with Hooks
The useOnMount Hook
The useOnMount Hook has a similar effect to the componentDidMount life cycle. It is used as follows:
import React from 'react'
import { useOnMount } from 'react-hookedup'
export default function...