1.0.1 • Published 5 years ago
use-key-down v1.0.1
useKeyDown 
 
 
 
 
Listen to key down events with React hooks.
Install
npm install use-key-downoryarn add use-key-down
Use
import useKeyDown from 'use-key-down';
function App() {
  const isEnterKeyDown = useKeyDown('Enter');
  return <p>The Enter key is {isEnterKeyDown ? 'down' : 'up'}.</p>;
}API
useKeyDown only takes one parameter, a string representing the key to which
you want to listen to key down events.
Sponsor 💗
If you are a fan of this project, you may become a sponsor via GitHub's Sponsors Program.