1.1.6 • Published 2 years ago

@jdthornton/usekeypress v1.1.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@jdthornton/usekeypress

npm (scoped) npm bundle size (minified)

React keypress hook.

Install

$ npm install @jdthornton/usekeypress

Usage

import useKeyPress from "@jdthornton/usekeypress";

function App({ isListening, handleClose }){

  // Listens for an 'ESC' key press event if isListening is true
  useKeyPress(isListening ? handleClose : null, 27)

  return null
}