Redux-saga put 方法不会触发 reducer

Redux-saga put method doesn't trigger reducer

我试图通过在我的 redux saga 中调用 put 方法来触发 redux reducer,但它没有被触发,即使我 return 应该在我的 reducer 中捕获相同的操作类型。

这是我的传奇:

export function* registrationSaga(action) {
  try {
    const response = yield call(registerUser, action.payload);
    console.log(response)
    yield put({ type: REGISTER_USER_SUCCESS, response })
  } catch(error) {
    yield put({ type: REGISTER_USER_ERROR, error });
  }
}

这是我的减速器:

export const registrationReducer = (state = {}, action) => {
let response = action.response;

switch(action.type) {
  case REGISTER_USER_SUCCESS: {
    console.log("successful registration")
    return { ...state, registration_success: response.success, registration_message: response.message };
  }

  case REGISTER_USER_ERROR:
    return { ...state, registration_success: response.success, registration_message: response.message };
  default:
    return state;
}
}

我希望在我的控制台中看到 "successful registration" 并在我的组件中获得该响应作为 prop,但这并没有发生。是什么导致了这个问题?

这是我的 rootReducer 和存储:

const rootReducer = () => combineReducers({
    registrationReducer,
    todoReducer
})

export default rootReducer;

并存储:

const sagaMiddleware = createSagaMiddleware()

export const store = createStore(
    rootReducer,
    applyMiddleware(sagaMiddleware)
);

sagaMiddleware.run(rootSaga)

rootReducer 不应是调用 combineReducers 函数 ,而应是 combineReducers 的 return 值:

const rootReducer = combineReducers({
    registrationReducer,
    todoReducer,
});

export default rootReducer;

Redux API