Single handler on multiple listener on react

前端 未结 3 1737
陌清茗
陌清茗 2020-12-07 06:45

Were trying to use es6 to make dynamic state without multiple handlers but I\'m stuck. I\'ve no clue what\'s wrong with my code below

3条回答
  •  独厮守ぢ
    2020-12-07 07:00

    I think you are not binding the proper context to your function handleAdvancePrice.

    If you are building your component using ES6 Class then, you can bind the context to all your functions in constructor like this:

    constructor() {
       this.handleAdvancePrice = this.handleAdvancePrice.bind(this);
    }
    

提交回复
热议问题