useKey
A hook that listens for a key press and calls a function when the key is pressed.
Installation
Usage
import { useKey } from "@/hooks/useKey";
useKey({ key: "Escape", eventName: "keydown", handler: () => { console.log("Escape key pressed!"); }, });