React hooks for capturing entries from HID devices.
yarn add react-hid
or
npm install --save react-hid
Retrieve all key strokes before an action key is pressed
import { useHidWithActionKey } from 'react-hid';
const handleKeys = (keys: string) => {
console.log(keys);
};
useHidWithActionKey('Enter', handleKeys);
Retrieve all key strokes real time
import { useHid } from 'react-hid';
const handleKey = (key: string) => {
console.log(key);
};
useHid(handleKey);