I am getting this error
Uncaught TypeError: Providing your root Epic to
createEpicMiddleware(rootEpic)
is no longer supported, instead useepicMiddleware.run(rootEpic)
When simply using
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))
Kindly help to resolve this
Well, have you tried:
?
Try this
official documentation createEpicMiddleware.
First, take a look at this document: Official Redux-Observable Document because we're using the newest version of Redux-Observable, then reviewing its document is quite helpful.
After reviewing the document, let's see a small example project (Counter app):
This is the
root.js
file which contains my Epics and Reducers after bundling.And this is
store.js
where I define my store before using it.In order to successfully implement
redux-observable
, we have to obey this order:createEpicMiddleware()
methodapplyMiddleware()
method to register the epicMiddleware (theredux-devtools-extension
is optional)epicMiddleware.run()
with therootEpic
we created earlier.This is the instruction from the Redux-Observable Document
For more information, you could find it here: : Setting Up The Middleware: