Search code examples
reduxreact-reduxredux-saga

How to run redux devtools with redux saga?


Trying to run reduxdevtools with redux saga:

Getting this error:

Error
Before running a Saga, you must mount the Saga middleware on the Store using applyMiddleware

This is my jscode:

const store = createStore(
  reducer,
  applyMiddleware(sagaMiddleware),
  window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
);

How can I run this devtool with saga? Alternatively what would work otherwise? codepen


Solution

  • I've used redux-devtools-extension package as described here, redux-devtools-extension documentation.

    After adding the package, I've replaced the store definition with this:

    const store = createStore(
      reducer,
      composeWithDevTools(
        applyMiddleware(sagaMiddleware)
      )
    );
    

    Fixed Codepen Link