redux-reducers
Unobtrusive reusable redux reducers
WARNING
Experimental - do not use in production.
Usage
Given the following action creator and reducer:
{ return type: 'ADD' payload ;} // { type: 'ADD', payload: 1 } { }
wrapActionCreator(idCreator, actionCreator)
; const wrappedAdd = ; // creates an action that will only be targeted by wrapped reducers
wrapReducer(idCreator, reducer)
;; const reducer = ; const store = ; const wrappedAdd = ; store; store; // { one: 1, two: 0 }
wrapDispatch(dispatch, idCreator)
;; const store = ; const dispatchToMyTarget = ; ; // action that will be picked up by reducers that target that id
idCreator
idCreator
can be a string, number or a function, where the function is
of the form:
{ return actionmetaid;}
composeReducers(reducers)
Compose reducers from right to left.
const action = type: ACTION_TYPE payload: 1; { } { } const composedReducer = ; ; // 2