Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save iamnnort/05f156c637129a8750e4835f1279aae5 to your computer and use it in GitHub Desktop.
Save iamnnort/05f156c637129a8750e4835f1279aae5 to your computer and use it in GitHub Desktop.
How to mimic componentDidUpdate() with React Hooks
const App = props => {
const didMountRef = useRef(false)
useEffect(() => {
if (didMountRef.current) {
doStuff()
} else didMountRef.current = true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment