Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 427
bier hier Avatar asked Oct 04 '18 06:10

bier hier


People also ask

Can I use Redux toolkit with Saga?

Redux-Saga is one of the popular middleware libraries for Redux. It makes working with asynchronous operations and side effects a lot easier. Unlike other libraries like Redux Thunk, Redux-Saga uses ES6 generators. Therefore, you should be knowledgeable in ES6 generators to implement Sagas correctly.

Is Redux and Redux saga same?

Redux has a broader approval, being mentioned in 1036 company stacks & 832 developers stacks; compared to redux-saga, which is listed in 43 company stacks and 21 developer stacks.


1 Answers

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

like image 64
trkaplan Avatar answered Oct 05 '22 20:10

trkaplan