Tôi muốn sử dụng sự kiện keyDown trên div trong React. Tôi làm:
  componentWillMount() {
      document.addEventListener("keydown", this.onKeyPressed.bind(this));
  }
  componentWillUnmount() {
      document.removeEventListener("keydown", this.onKeyPressed.bind(this));
  }      
  onKeyPressed(e) {
    console.log(e.keyCode);
  }
  render() {
    let player = this.props.boards.dungeons[this.props.boards.currentBoard].player;
    return (
      <div 
        className="player"
        style={{ position: "absolute" }}
        onKeyDown={this.onKeyPressed} // not working
      >
        <div className="light-circle">
          <div className="image-wrapper">
            <img src={IMG_URL+player.img} />
          </div>
        </div>
      </div>
    )
  }
Nó hoạt động tốt, nhưng tôi muốn làm điều đó nhiều hơn theo phong cách React. Tôi đã thử
        onKeyDown={this.onKeyPressed}
trên thành phần. Nhưng nó không phản ứng. Nó hoạt động trên các yếu tố đầu vào như tôi nhớ lại.
Tôi làm nó như thế nào?