小编bug*_*aws的帖子

我可以让Redux-Saga和Redux-Thunk一起工作吗?

我正在使用redux-saga,但我遇到了一个问题:redux-auth-wrapper需要redux-thunk来进行重定向,所以我只是在我的商店中添加了thunk:

  import {createStore, compose, applyMiddleware} from 'redux';
  import createLogger from 'redux-logger';
  import {routerMiddleware} from 'react-router-redux';
  import {browserHistory} from 'react-router';
  import thunk from 'redux-thunk';
  import createSagaMiddleware, {END} from 'redux-saga';
  import sagas from '../sagas';
  import reduxImmutableStateInvariant from 'redux-immutable-state-invariant';
  import rootReducer from '../reducers';
  import _ from 'lodash';
  import {loadState, saveState} from '../connectivity/localStorage';

  const persistedState = loadState();

  const routerMw = routerMiddleware(browserHistory);
  const loggerMiddleware = createLogger();
  const sagaMiddleware = createSagaMiddleware();

  function configureStoreProd() {
    const middlewares = [
      // Add other middleware on this line...

      routerMw, …
Run Code Online (Sandbox Code Playgroud)

redux redux-thunk redux-saga

12
推荐指数
2
解决办法
2441
查看次数

标签 统计

redux ×1

redux-saga ×1

redux-thunk ×1