Skip to content

Redux toolset for isolating state as defined by ducks-modular-redux proposal.

License

Notifications You must be signed in to change notification settings

salsita/redux-ducks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redux-ducks

Redux toolset for isolating state as defined by ducks-modular-redux proposal.

Don't use the package in production yet, it's just a proof of concept

State isolation implementation based on ducks-modular-redux proposal.

Usage

The package provides buildDucksReducer. The function takes your original top level reducer as first argument and returns another function which takes N ducks reducers. See example usage in react-redux-ducks example.

import { createStore } from 'redux';
import { buildDucksReducer } from 'redux-ducks';

// This is your plain old top level reducer (for example result of combinReducers function)
const yourTopLevelReducer => (appState, action) => {
  return appState;
};

// Ducks standard reducer as defined in ducks-modular-redux
const ducksReducer = (appState, action) => {
  return appState;
};

const topLevelReducer = buildDucksReducer(yourTopLevelReducer)(ducksReducer, anotherDucksReducer);

const store = createStore(topLevelReducer);

Examples

See examples in react-redux-ducks repo.

About

Redux toolset for isolating state as defined by ducks-modular-redux proposal.

Resources

License

Stars

Watchers

Forks

Packages

No packages published