ICode9

精准搜索请尝试: 精确搜索
  • bind绑定(改变this指向)2022-06-20 20:02:29

    constructor(props){ super(props) this.state=store.getState() this.changeInputValue=this.changeInputValue.bind(this) this.storeChange=this.storeChange.bind(this) this.clickBtn=this.clickBtn.bind(this) store.subscribe(this.store

  • Cannot read properties of undefined (reading 'setState')2022-06-19 03:01:30

      this的指向不对,需要用bind绑定this 例如 constructor(props){ super(props) this.state=store.getState() this.changeInputValue=this.changeInputValue.bind(this)//绑定 store.subscribe(this.storeChange)//订阅 }  

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有