Inspired by donovan/use-event-listener
A custom Preact Hook that provides a declarative useEventListener.
This package has Preact 10+ as a peer dependency.
npm install @preact-hooks/event
or yarn add @preact-hooks/event
You can also load it via the unpkg CDN
https://unpkg.com/@preact-hooks/event
will download the latest UMD bundle.
For usage and examples see donovan/use-event-listener.