Created
May 4, 2020 21:27
-
-
Save Franckapik/8495f7e5abb749fce2b53b99cdf251fe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {useHotkeys} from 'react-hotkeys-hook' | |
import { useStoreState, useStoreActions, action } from 'easy-peasy'; | |
const KeyControls= (props) => { | |
const moveUP = useStoreActions(action => action.moveUP) | |
useHotkeys('up', event => { | |
if (event.type === "keydown") { | |
console.log("down"); | |
} else if (event.type === 'keyup') { | |
console.log("up"); | |
} | |
moveUP('up') | |
}); | |
return null | |
} | |
export default KeyControls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment