epicMiddleware和routerMiddleware(history)调用无限循环并冻结浏览器

时间:2019-05-20 12:24:44

标签: reactjs redux react-redux

enter image description here

我尝试配置react-observable。我尝试配置存储。但是,当我尝试解决您的问题时,您可以在屏幕上看到上面的内容,我的浏览器冻结了页面,因此我什么也不能做。在这里您可以检查代码:

import { createBrowserHistory } from 'history'
import { applyMiddleware, compose, createStore } from 'redux'
import { routerMiddleware } from 'connected-react-router'
import { createEpicMiddleware} from 'redux-observable'

import { rootEpic } from './epics/root'

import createRootReducer from './reducers'

export const history = createBrowserHistory();

const epicMiddleware = createEpicMiddleware();

export default function configureStore(preLoadedState) {
  const store = createStore(
    createRootReducer(history),
    preLoadedState,
    compose(
      applyMiddleware(
        epicMiddleware,
        routerMiddleware(history),
      ),
    ),
  );

  epicMiddleware.run(rootEpic);

  return store
}

问题在这里,但我不知道如何解决:

epicMiddleware,
routerMiddleware(history)

如果我的解释不清楚,请告诉我,我会尽力的

0 个答案:

没有答案