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
The problem is that ChildComponent
is not a component but a component factory. It will be replaced with the result of rendering the element created with that factory.
Insert the See it in action on codepenChildComponent
in a div and attach any event listener to the div, not ChildComponent
. Replace if you need inline display.
let {Component} = React;
class ChildComponent extends Component {
render() {
return (