1.1.2 • Published 12 months ago

async-reducer-manager v1.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months 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

12 months ago

1.1.1

12 months ago

1.1.0

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago