React model刷新页面改变state

export default {

namespace:"demo1",

state:{

state1:'',

state2:''

},

subscriptions:{

method({dispatch,history}){

return history.listen((pathname)=>{

pathname="" && dispatch({type:''method",params:{}});

})

}

 

},

*method({params},{call,put,select}){

let state1= yield select(state=>state.demo1);

let result = yield call(method,{id:id});

yield put({type:'method',params:{}});&& yield put({type:"namespace/method1",params:{}})

yield put({type:'setState',payload:{}});

params callback && params callback();     =>this.props.dispatch({type:''/demo1/method",params:{}});

}

reducers:{

    setState(state,action){

retrun{

       ...state,

       ...action.payload

}

}

}

}

你可能感兴趣的:(React model刷新页面改变state)