Skip to content

Instantly share code, notes, and snippets.

@onion2k
Created January 5, 2021 12:00
Show Gist options
  • Select an option

  • Save onion2k/a11739a8bf3f815ded51679a592d5d02 to your computer and use it in GitHub Desktop.

Select an option

Save onion2k/a11739a8bf3f815ded51679a592d5d02 to your computer and use it in GitHub Desktop.
Using a hook in place of componentWillMount and componentWillUnmount
useEffect(()=>{
console.log("Mounted component")
return () => {
console.log("Unmounted component")
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment