redux-toolbelt-saga
A set of helper functions that extends 'redux-toolbelt' for usage with redux-saga
.
TOC
Installation
The tools are available in the redux-toolbelt
npm package.
npm install --save redux-toolbelt redux-toolbelt-saga redux-saga
yarn add redux-toolbelt redux-toolbelt-saga redux-saga
Usage
import the functions you like to use using one of the two methods:
import {makeAsyncActionCreator} from 'redux-toolbelt'
import {makeAsyncSaga} from 'redux-toolbelt-saga'
import makeAsyncActionCreator from 'redux-toolbelt/lib/makeAsyncActionCreator'
import makeAsyncSaga from 'redux-toolbelt-saga/lib/makeAsyncSaga'
API Reference
makeAsyncSaga()
Creates a saga that handles actions created using makeAsyncActionCreator
.
The first argument specifies saga when to dispatch the function in the second argument.
Other arguments are passed to the function when it is run.
const fetchTodos = makeAsyncActionCreator('FETCH_TODOS')
const fetchTodosFromServer = () => {}
const saga = makeAsyncSaga(fetchTodos, fetchTodosFromServer)