使用redux-observable和redux-form for react-redux-promise-listener的示例

时间:2018-05-02 08:14:54

标签: redux-form redux-observable

React-redux-promise-listener仅包含与React Final Form一起使用的示例。

将它与redux-forms和redux-observable一起使用的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

在redux-observable上使用它取得了一些成功。您看到setup linked了吗?当我在做类似的事情时对我有帮助:

// createStore.js

...

import createReduxPromiseListener from 'redux-promise-listener';

const reduxPromiseListener = createReduxPromiseListener();

function createStoreWrapper(history, testMiddleware) {
  const middleware = [
    createRouterMiddleware(history),
    createEpicMiddleware(rootEpic),
    createRavenMiddleware(Raven, {
      // Optionally pass some options here.
    }),
    reduxPromiseListener.middleware,
  ];
  if (testMiddleware) middleware.push(testMiddleware);

  const enhancers = [responsiveStoreEnhancer, applyMiddleware(...middleware)];

  if (typeof window.__REDUX_DEVTOOLS_EXTENSION__ !== 'undefined') {
    enhancers.push(window.__REDUX_DEVTOOLS_EXTENSION__());
  }

  const initialState = getInitialState();
  const enhancer = compose(...enhancers);

  const store = createStore(rootReducer, initialState, enhancer);

  addHandlers(store);

  return store;
}

另请参阅我的问题stack post