请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

关于store.subscribe的监听问题

为什么store.subscribe只在监听handleStoreChange函数时可以正常运行,而在监听按钮事件函数时会持续运行直到崩溃呢

正在回答 回答被采纳积分+3

1回答

Dell 2020-09-27 00:58:46

代码扔上来,我看你怎么写的

0 回复 有任何疑惑可以回复我~
  • 提问者 DF11G #1
    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) // 监听函数为按钮事件时会一直执行直到崩溃
    	}
    回复 有任何疑惑可以回复我~ 2020-09-27 23:04:37
  • Dell 回复 提问者 DF11G #2
    handleClickChange 的代码发上来看一下
    回复 有任何疑惑可以回复我~ 2020-10-06 01:44:17
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号