0

在render函数会打印4次结果,如果不再reducers更新state数据,直接通过callback就不会打印4次结果,你们是怎么解决的呢?

//model.js
effects: {
   *fetchMainQuery({ payload,callback }, { call, put }) {
      const response = yield call(queryMainQuery,payload);
      yield put({
        type: 'showMainQuery',
        payload: response&&response.PlanInfo,
      })
    },
}
reducers: {
    showMainQuery(state, { payload }) {
      return {
        ...state,
        data:payload,
      };
    },
  },


//index.js
  ...
  render() {
    const {data,loading} = this.props.submissionCentre;
    console.log(data'==data')//会打印4次结果
    
  }

http_404 216
8月1日提问
0 个回答

撰写答案

推广链接