Uncaught TypeError: Cannot read property 'props' of null

后端 未结 4 1530
猫巷女王i
猫巷女王i 2021-01-30 14:00
  • I have a react code
  • this code renders various panels in the UI.
  • when I click a tag, this function is called sportsCornerPanel()
  • but I am getting
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-30 14:36

    binding the method in constructor worked absolutely fine.

    class Example extends Component {
    
      constructor(props) {
        super(props);
        this.homeButtonClicked= this.homeButtonClicked.bind(this);
      }
    }
    

提交回复
热议问题