mocheng / react-and-redux

《深入浅出React和Redux》代码

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

第三章里面的 redux_basic里面有个疑问

refanbanzhang opened this issue · comments

componentDidMount() {
store.subscribe(this.onChange);
}

componentWillUnmount() {
store.unsubscribe(this.onChange);
}
这里的对store.unsubscribe应该是会报错的,因为unsubscribe方法是subscribe的返回值
store.unsubscribe = store.subscribe(this.onChange);