๐ฅง useKeyPress
January 9, 2020 ยท View on GitHub
Adds keydown/keyup listeners to any key
Arguments
targetKey: String: A key on the keyboard. Required
Returns
keyPressed: Bool: true on keydown are the targetKey.
Usage
import { useKeyPress } from "react-recipes";
function App() {
const happyPress = useKeyPress("h");
return <div>{happyPress && "๐"}</div>;
}