采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
为什么store.subscribe只在监听handleStoreChange函数时可以正常运行,而在监听按钮事件函数时会持续运行直到崩溃呢
代码扔上来,我看你怎么写的
constructor(props) { super(props) //使用store的getState()方法从store提取数据 this.state = store.getState() this.handleInputChange = this.handleInputChange.bind(this) this.handleStoreChange = this.handleStoreChange.bind(this) this.handleClickChange = this.handleClickChange.bind(this) this.handleDeleteChange = this.handleDeleteChange.bind(this) store.subscribe(this.handleStoreChange) // 可以正常工作 //store.subscribe(this.handleClickChange) // 监听函数为按钮事件时会一直执行直到崩溃 }
handleClickChange 的代码发上来看一下
登录后可查看更多问答,登录/注册
主流新技术 React-redux,React-router4,贯穿基础语法
6.2k 22
6.3k 20
2.4k 19
5.1k 17
1.8k 13
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号