Skip to content

andyjessop/redux-dynamic-registry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redux Dynamic Registry

Redux Dynamic Registry is a tool to dynamically add and remove reducers and middleware. It was conceived to aid code-splitting.

It's very small, weighing-in <600B minified and gzipped.

Usage

import { createStore } from 'redux';
import { createDynamicMiddleware, createDynamicReducer } from 'redux-dynamic-registry';

// Middleware
const dynamicMiddleware = createDynamicMiddleware();

const store = createStore(
  reducer,
  applyMiddleware(
    // ...other app middleware,
    dynamicMiddleware.middleware
  )
);

dynamicMiddleware.add(middleware, order);
dynamicMiddleware.remove(middleware);

// Reducer
const dynamicReducer = createDynamicReducer();
dynamicReducer.add(store, namespace, reducer);
dynamicReducer.remove(store, namespace);

About

A dynamic reducer and middleware registry for Redux.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published