我收到此错误


  未捕获的TypeError:将您的根Epic提供给
  不再支持createEpicMiddleware(rootEpic),而是使用
  epicMiddleware.run(rootEpic)


简单使用时

import 'rxjs'
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { reducer as formReducer } from 'redux-form'
import thunk from 'redux-thunk'
import promise from 'redux-promise-middleware'
import { createEpicMiddleware, combineEpics } from 'redux-observable'

import app from './app'

// Bundling Epics
const rootEpic = combineEpics(
)

// Creating Bundled Epic
const epicMiddleware = createEpicMiddleware(rootEpic)

// Define Middleware
const middleware = [
  thunk,
  promise(),
  epicMiddleware
]

// Define Reducers
const reducers = combineReducers({
  form: formReducer
})

// Create Store
export default createStore(reducers,window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), applyMiddleware(...middleware))


请帮助解决此问题

最佳答案

尝试这个

import 'rxjs'
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { reducer as formReducer } from 'redux-form'
import thunk from 'redux-thunk'
import promise from 'redux-promise-middleware'
import { createEpicMiddleware, combineEpics } from 'redux-observable'

import app from './app'

// Bundling Epics
const rootEpic = combineEpics(
)

// Creating Bundled Epic
const epicMiddleware = createEpicMiddleware();

// Define Middleware
const middleware = [
  thunk,
  promise(),
  epicMiddleware
]

// Define Reducers
const reducers = combineReducers({
  form: formReducer
})

// Create Store
const store = createStore(reducers,window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(), applyMiddleware(...middleware))
epicMiddleware.run(rootEpic);
export default store


官方文档createEpicMiddleware

关于javascript - 未捕获的TypeError:将您的根Epic提供给createEpicMiddleware(rootEpic),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52222160/

10-09 21:46