Last active
June 28, 2019 22:11
-
-
Save chris-feist/5d5b62ff261556c9ed059a1e73b18a2a to your computer and use it in GitHub Desktop.
React Hooks: useWindowDropZone.js onDrop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect } from 'react'; | |
export default (args) => { | |
const { | |
onDrop, | |
} = args; | |
useEffect(() => { | |
window.addEventListener('drop', onDrop); | |
return () => { | |
window.removeEventListener('drop', onDrop); | |
}; | |
}, [onDrop]); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment