@guiguzixl/redux-add-reducer

2.0.2 • Public • Published

redux-add-reducer

Add dynamically reducer.

install

npm install --save @guiguzixl/redux-add-reducer

or

yarn add @guiguzixl/redux-add-reducer

example

用法和 redux 几乎一样,区别在于创建 store 的时候不用再传入 reducer,而是通过 store.addReducer 动态的添加 reducer。addReducer 接受一个对象为参数,和 combineReducers 一致,另外 preloadedState 必须为对象。

import { createStore } from '@guiguzixl/redux-add-reducer'
const store = createStore(preloadedState, enhancer)

const addReducerShape = {
  reducerKey: reducerFunction,
}
store.addReducer(addReducerShape)

Package Sidebar

Install

npm i @guiguzixl/redux-add-reducer

Weekly Downloads

7

Version

2.0.2

License

ISC

Unpacked Size

45.8 kB

Total Files

11

Last publish

Collaborators

  • xiaopa