A simple Mousetrap hook for handling keyboard shortcuts in React.
yarn add use-mousetrap
npm install --save use-mousetrap
import { useMousetrap } from 'use-mousetrap';
useMousetrap('ctrl+enter', () => {
console.log('Squeek! Squeek!');
});
For more details, you can read the Mousetrap documentation.