Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Created August 26, 2019 02:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CMCDragonkai/5edaccd6688fca87013613993ca0236a to your computer and use it in GitHub Desktop.
Save CMCDragonkai/5edaccd6688fca87013613993ca0236a to your computer and use it in GitHub Desktop.
React Lifecycle Hooks #js #react
// all react lifecycle stages can be hooked into using the `useEffect` hooks
// acquired from here: https://stackoverflow.com/a/55041347/582917
useEffect( () => console.log("mount"), [] );
useEffect( () => console.log("will update data1"), [ data1 ] );
useEffect( () => console.log("will update any") );
useEffect( () => () => console.log("will update data1 or unmount"), [ data1 ] );
useEffect( () => () => console.log("unmount"), [] );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment