在react应用中,使用redux创建store,但是不想用react-redux。
那这样应该如何在store.subscribe
进行操作,才能重新render?
store.subscribe(function(){
//如何触发state更新(重新render组件)
})
或者怎么才能在构造函数中重新render?
constructor() {
super();
this.state = {
count :0
}
this.add = function() {
store.dispatch(add_todo('增加+'))
}
this.reduce = function(){
store.dispatch(subtraction_todo('递减-'))
}
}
请各位前辈们指教!