1.1.2 • Published 2 years ago

async-reducer-manager v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

The library is designed to help you create asynchronous reduxers for the Redux store. The library also contains a React component for easy addition and removal of editors.


###Example:

import { CombinedState, configureStore, Reducer, ReducersMapObject } from '@reduxjs/toolkit';
import { createReducerManager, ReduxStoreWithManager } from 'async-reducer-manager';

export function createReduxStore<StateSchema>(rootReducers: ReducersMapObject<StateSchema>) {
    const reducerManager = createReducerManager<StateSchema>(rootReducers);

    const store = configureStore({
        reducer: reducerManager.reduce as Reducer<CombinedState<StateSchema>>,
        devTools: __IS_DEV__,
    }) as ReduxStoreWithManager<StateSchema>;

    store.reducerManager = reducerManager;

    return store;
}
import { DynamicModuleLoader } from 'async-reducer-manager';

interface IProps {
    Your props...
}

const initialReducers: ReducersList<StateSchema> = {
    Your reducer...
};

export const ComponentName = (props: IProps) => {
    Component logic...

    return (
        <DynamicModuleLoader reducers={initialReducers} removeAfterUnmount>
            Your components
        </DynamicModuleLoader>
    );
}

DynamicModuleLoader accepts two parameters as passes:

  • redusers - list of reducers to add to the store.
  • removeAfterUnmount - flag indicating whether to leave the added reducers in the store after unmounting the component or delete (true - delete).
1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago