Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const {stdin, setRawMode} = useContext(StdinContext);
- useEffect(() => {
- setRawMode(true);
- const handleInput = key => {
- const direction = keyToDirection(key);
- if (direction) {
- state.chosenDirection = direction;
- }
- };
- stdin.on('data', handleInput);
- return () => stdin.removeListener('data', handleInput);
- }, []);
- // {...}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement