How to use `componentDidUpdate()` with `useEffect()`?

function Component() {
  useEffect(() => console.log('Component did update AND mount!'))
  
  return null
}
Copy

September 6th, 2019

# componentDidUpdate() as hook

Add to bookmarks

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.

Tracking with Matomo to improve the UX. See Privacy Policy for more details.