---
title: "Discussion on \"React useEventListener Hook: Type-Safe DOM Events (2026)\" | Hashnode"
description: "Discussion on \"React useEventListener Hook: Type-Safe DOM Events (2026)\". Here's a modal close-on-Escape that quietly does the wrong thing:\nfunction Modal({ onClose }: { onClose: () => void }) {\n  useEffect(() => {\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key ="
url: "https://hashnode.com/posts/react-useeventlistener-hook/6a86c3076e46815100f61a32"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [React useEventListener Hook: Type-Safe DOM Events (2026)](https://reactuse.hashnode.dev/react-useeventlistener-hook?utm_source=hashnode&utm_medium=feed)

Here's a modal close-on-Escape that quietly does the wrong thing: function Modal({ onClose }: { onClose: () => void }) { useEffect(() => { const onKey = (e: KeyboardEvent) => { if (e.key =

Aug 20 · 12 min read · reactuse.hashnode.dev  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[ReactUse](https://hashnode.com/@reactuse)

@reactuse

  
[View profile](https://hashnode.com/@reactuse)

Collection of 110+ essential React Hooks. Tree-shakable, SSR-safe, TypeScript-first.

Maintainer of @reactuses/core — 110+ essential React Hooks: SSR-safe, TypeScript-first, tree-shakeable. Docs &amp; interactive demos: https://reactuse.com · MIT-licensed and maintained in spare time — sponsorships keep it going: https://github.com/sponsors/childrentime

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
