Adds keydown/keyup listeners to any key
targetKey: String
: A key on the keyboard. Required
keyPressed: Bool
: true on keydown are the targetKey.
import { useKeyPress } from "react-recipes";
function App() {
const happyPress = useKeyPress("h");
return <div>{happyPress && "π"}</div>;
}