Skip to content

Instantly share code, notes, and snippets.

@dbilgili
Created December 12, 2018 22:06
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 dbilgili/707ae298c091d424511376e129da9285 to your computer and use it in GitHub Desktop.
Save dbilgili/707ae298c091d424511376e129da9285 to your computer and use it in GitHub Desktop.
// vim: syntax=JSX
componentDidUpdate(){
setTimeout(() => {
if(this.state.isOpen){
window.addEventListener('click', this.close)
}
else{
window.removeEventListener('click', this.close)
}
}, 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment