Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Mar 21, 2024 via pnpm

redux-saga 1.2.3

Saga middleware for Redux to handle Side Effects
Package summary
Share
0
issues
1
license
12
MIT
Package created
2 Dec 2015
Version published
17 Mar 2023
Maintainers
3
Total deps
12
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
12 Packages, Including:
@babel/runtime@7.24.1
@redux-saga/core@1.3.0
@redux-saga/deferred@1.2.1
@redux-saga/delay-p@1.2.1
@redux-saga/is@1.1.3
@redux-saga/symbols@1.1.3
@redux-saga/types@1.2.1
redux-saga@1.2.3
regenerator-runtime@0.14.1
typescript-compare@0.0.2
typescript-logic@0.0.0
typescript-tuple@2.2.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of redux-saga 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
@redux-saga/core1.3.089.54 kBMIT
prod

Visualizations

Frequently Asked Questions

What does redux-saga do?

Redux-Saga is a library that aims to make side effects (i.e. asynchronous things like data fetching, impure procedures such as accessing the browser cache) in Redux-based applications easier and better to handle. It accomplishes this using an ES6 feature called Generators, allowing us to write asynchronous code that looks synchronous, and is very easy to test.

How do you use redux-saga?

To use Redux-Saga, you need to follow several steps. First, you have to install it using npm or Yarn:

npm install redux-saga

yarn add redux-saga

Second, you create sagas to handle the side effects in your application. A basic saga could look like this:

import { call, put, takeEvery } from 'redux-saga/effects';

function* fetchUser(action) {
   try {
      const user = yield call(Api.fetchUser, action.payload.userId);
      yield put({type: "FETCH_USER_SUCCESS", user: user});
   } catch (e) {
      yield put({type: "FETCH_USER_FAILURE", message: e.message});
   }
}

This saga watches for every FETCH_USER_REQUEST action and triggers fetchUser function.

For step three, you run your saga. You create the Redux store as before, but also apply the sagaMiddleware:

import { createStore, applyMiddleware } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { fetchUserSaga } from './sagas';

const sagaMiddleware = createSagaMiddleware();

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

sagaMiddleware.run(fetchUserSaga);

This is a simple example. Depending on your needs, you would have to structure your sagas in a way that makes sense for your application, setup error handling, etc.

Where are the redux-saga docs?

The documentation for Redux-Saga can be found on their official website. The docs are comprehensive and they cover everything from basic usage, advanced concepts, extensive API reference, testing methodology, and numerous examples. The Redux-Saga community is actively maintaining these docs, making sure they remain updated and relevant to always offer help to developers at all levels.