October 2019
Intermediate to advanced
426 pages
11h 49m
English
This Hook works similarly to adding a function on componentDidMount and componentDidUpdate. Furthermore, the Effect Hook allows for returning a cleanup function from it, which works similarly to adding a function to componentWillUnmount.
The useEffect Hook is used to deal with effectful code, such as timers, subscriptions, requests, and so on. We can use it as follows:
import { useEffect } from 'react'useEffect(didUpdate)
The useEffect Hook replaces the componentDidMount, componentDidUpdate, and componentWillUnmount methods.
Read now
Unlock full access