You may not call store.getState() while the reducer is executing.
The reducer has already received the state as an argument.
Pass it down from the top reducer instead of reading it from the store.
解决办法,举个例子
原代码
export const validateExpirationDate = async date => {
if (!date) return;
const app = getDvaApp();
const rootState = app._store.getState() || {};
const { expirationDate = {} } = rootState;
const { volatilityCalendars } = expirationDate;
};
修改之后代码
export const validateExpirationDate = async date => {
if (!date) return;
const _validateExpirationDate = async () => {
const app = getDvaApp();
const rootState = app._store.getState() || {};
const { expirationDate = {} } = rootState;
const { volatilityCalendars } = expirationDate;
};
setTimeout(_validateExpirationDate);
};