I want my app to detect left and right arrow key presses. I got it to work, however, I have to click on the App component for it to register. How can I handle this event without click anywhere / the entire document? How am I able to detect exactly which keys are pressed?
// App.js
keyHandler = e => {
console.log(e);
};
render() {
return (
<div onKeyDown={this.keyHandler} tabIndex="0">