Today we’re going to be creating a custom React Hook, useEventListener!
React doesn’t have a great way to create a global click handler, so we’re going to be creating a custom Hook to fulfill our needs!
Follow along as we write some code!
Source code: https://github.com/hswolff/youtube/blob/master/videos/react-demos/src/demo/use-event-listener.js
Part 2, Conditional Hooks: https://morioh.com/p/a65010416073
Part 3: Using TypeScript: https://morioh.com/p/dabbf979f2bb
#react #javascript #developer