redux-fsa
Flux Standard Action utilities for Redux.
npm install --save redux-fsa
createAction(type, actionCreator)
Wraps an action creator so that its return value is the payload of a Flux Standard Action. If no action creator is passed, or if the action creator is not a function, the identity function is used.
Example:
let increment = ;// same asincrement = ; todeep;
handleAction(type, reducer | reducerMap)
Wraps a reducer so that only handles Flux Standard Actions of a certain type.
If a single reducer is passed, it is used to handle both successful and failed actions. You can use this form if you know a certain action will always be a success, like the increment example above.
Otherwise, you can specify reducers for success
and error
:
;
handleActions(reducerMap, ?defaultState)
Creates multiple reducers using handleAction()
and combines them into a single reducer that handles multiple actions. Accepts a map where the keys are the passed as the first parameter to handleAction()
(the action type), and the values are passed as the second parameter (either a reducer or reducer map).
The optional second parameter specifies a default or initial state, which is used when undefined
is passed to the reducer.
(Internally, handleActions()
works by applying multiple reducers in sequence using reduce-reducers.)
Example:
const reducer = ;
Suggested libraries
Use redux-fsa in combination with FSA-compliant libraries.
- redux-promise - Promise middleware