const once = useRef(false) useEffect(() => { if(once.current === false){ once.current = true // do things as were in componentDidMount return } // do things as were in componentDidUpdate // clean up return () => { // } }) // <- no need to pass in 2nd argument