31
rated 0 times
[
37]
[
6]
/ answers: 1 / hits: 24946
/ 9 Years ago, thu, august 27, 2015, 12:00:00
I'm trying to implement some very basic key press detection and I can't get it to work at all. I have a bare component that should be picking up on the onKeyDown
event but nothing gets logged out in the console:
class App extends React.Component {
constructor(props) {
super(props);
}
handleKeyDown(event) {
console.log('handling a key press');
}
render() {
return (
<ChildComponent onKeyDown={this.handleKeyDown} />
);
}
}
React.render(<App />, document.getElementById('app'));
More From » reactjs