ducksReducer
Combines reducers from redux-ducks modules into a single reducer.
It uses reducers defined as ducks, see ducks-modular-redux (aka isolated modules), and creates a reducer combining their reducers with combineReducers.
Quick Use
Install with npm:
npm install ducks-reducer
const reducer = // ...do your stuff... const store = // ...do your stuff...
ducksReducer(ducks)
It creates a reducer with combineReducers
with all the reducers
of the given reducers.
By default, it assumes that ducks are esModules and it looks for
the default
property which is suposed to be the reducer:
const reducer = // ^ this is equivalent to vconst reducer =
If default
is not found in any duck, then it assumes that it may be
an ES5 module. Then it looks for the duck itself, if it is a function,
then it is considered the reducer.
const reducer = // ^ this is equivalent to vconst reducer =
If the duck does not have a default
and the duck itself is not a function,
then it assumes that there is no reducer for that duck.
It supports to combine all three kinds of ducks (es6 modules, es5 modules and with no reducer).
const reducer = // ^ this is equivalent to vconst reducer =
See also
ducks-middleware to compose ducks middlewares.
const ducks = comments posts users const reducer = const middleware = // ...do your stuff... const store = // ...do your stuff...