Skip to content

Instantly share code, notes, and snippets.

@adamrosloniec
Created October 31, 2019 00:57
Show Gist options
  • Save adamrosloniec/202334c3d2ab253d4898a33bf6e883c6 to your computer and use it in GitHub Desktop.
Save adamrosloniec/202334c3d2ab253d4898a33bf6e883c6 to your computer and use it in GitHub Desktop.
React Hooks - useEffect as componentDidMount & componentWillUnmount
useEffect(() => {
// componentDidMount
InitAnyFunctionAfterDidMount();
// componentWillUnmount
return () => {
InitAnyFunctionAfterUnmount();
};
}, []);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment