Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create saga middleware using typed-redux-saga #507

Open
hemadriDasari1990 opened this issue Apr 6, 2021 · 0 comments
Open

How to create saga middleware using typed-redux-saga #507

hemadriDasari1990 opened this issue Apr 6, 2021 · 0 comments

Comments

@hemadriDasari1990
Copy link

hemadriDasari1990 commented Apr 6, 2021

I've updated to typed-redux-saga recently. Prior to this I was using redux-saga.

Saga middleware create with redux-saga looks as follows

import { applyMiddleware, compose, createStore } from "redux";

import createSagaMiddleware from "redux-saga";
import rootReducer from "../reducer";
import rootSaga from "../sagas";

declare global {
  interface window {
    __REDUX_DEVTOOLS_EXTENSION_COMPOSE__?: typeof compose;
  }
}
const reduxDevTools =
  (window as any).__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;

const sagaMiddleware = createSagaMiddleware();
const store = createStore(
  rootReducer,
  reduxDevTools(applyMiddleware(sagaMiddleware))
);

sagaMiddleware.run(rootSaga);

export default store;

My question is do I still need to use above way of creating saga middleware from redux-saga or it should be from typed-redux-saga?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant