Skip to content

Instantly share code, notes, and snippets.

@ohansemmanuel
Created April 13, 2019 08:15
Show Gist options
  • Select an option

  • Save ohansemmanuel/2c14da3b372a0dde39e9a0b0b11d38fb to your computer and use it in GitHub Desktop.

Select an option

Save ohansemmanuel/2c14da3b372a0dde39e9a0b0b11d38fb to your computer and use it in GitHub Desktop.
const MultipleEffects = () => {
// ๐ŸŸ
useEffect(() => {
const clicked = () => console.log('window clicked')
window.addEventListener('click', clicked)
return () => {
window.removeEventListener('click', clicked)
}
}, [])
// ๐ŸŸ another useEffect hook
useEffect(() => {
console.log("another useEffect call");
})
return <div>
Check your console logs
</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment