UNPKG

@preact-hooks/event

Version:

A custom Preact Hook that provides a declarative useEventListener.

52 lines (32 loc) 1.46 kB
<div align="center"> <h1>Preact Hooks - Event</h1> > Inspired by [donovan/use-event-listener](https://github.com/donavon/use-event-listener) [![version][version-badge]][package] [![MIT License][license-badge]][license] <p> A custom Preact Hook that provides a declarative useEventListener. </p> </div> <hr /> ## Table of Contents <!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> - [Installation](#installation) - [Docs](#docs) - [LICENSE](#license) <!-- END doctoc generated TOC please keep comment here to allow auto update --> ## Installation ***This package has [Preact 10+](https://github.com/preactjs/preact) as a peer dependency.*** `npm install @preact-hooks/event` or `yarn add @preact-hooks/event` You can also load it via the [unpkg](https://unpkg.com) CDN `https://unpkg.com/@preact-hooks/event` will download the latest UMD bundle. ## Docs For usage and examples see [donovan/use-event-listener](https://github.com/donavon/use-event-listener#usage). ## LICENSE [MIT](LICENSE) <!-- prettier-ignore-start --> [package]: https://www.npmjs.com/package/@preact-hooks/event [version-badge]: https://img.shields.io/npm/v/@preact-hooks/event [license]: https://github.com/mihar-22/preact-hooks-event/blob/master/LICENSE [license-badge]: https://img.shields.io/github/license/mihar-22/preact-hooks-event?color=b <!-- prettier-ignore-end -->