source: imaps-frontend/node_modules/react-use/esm/useKeyPress.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 426 bytes
Line 
1import { useState } from 'react';
2import useKey from './useKey';
3var useKeyPress = function (keyFilter) {
4 var _a = useState([false, null]), state = _a[0], set = _a[1];
5 useKey(keyFilter, function (event) { return set([true, event]); }, { event: 'keydown' }, [state]);
6 useKey(keyFilter, function (event) { return set([false, event]); }, { event: 'keyup' }, [state]);
7 return state;
8};
9export default useKeyPress;
Note: See TracBrowser for help on using the repository browser.