How to use `componentDidUpdate()` with `useEffect()`?
function Component() {
useEffect(() => console.log('Component did update AND mount!'))
return null
}
September 6th, 2019
useEffect()
can receive two arguments: a callback function and an array. A missing second argument will cause a callback call after every render. This will behave like a combination of componentDidMount
and componentDidUpdate
.