Nonlinear Performance Magnification

    redux-standard-reducer

    0.1.0 • Public • Published

    redux-standard-reducer

    A redux reducer for standard action that merge data to state

    Build Status Coverage Status npm version npm downloads npm license

    Install

    $ npm i redux-standard-reducer --save

    Usage

    // suppose all business reducer exits in app/reducers/
    import reducer from './app/reducers'
     
    import standardReducer from 'redux-standard-reducer'
    import reduceReducers from 'reduce-reducers'
     
    // reducer for createStore
    const finalReducer = reduceReducers(
      standardReducer,
      reducer
    )
     
    const store = createStore(initialState, finalReducer, enhancers)

    enable this reducer

    use any one of these:

    • make action.type starts with STANDARD_MERGE_STATE, this reducer will handle the action
    • make action.standard = true, this reducer will handle the action

    Action with payload

    action = {
      type,
      standard,
      payload: {...},
    }
    key type remark
    payload Object the data need to be merged to the store.state

    Action with update

    action = {
      type,
      standard,
      update: {...},
    }
    key type remark
    update Object the update operation, will pass to immutability-helper, equal to immutabilityHelper(store.state, action.update)

    Changelog

    CHANGELOG.md

    License

    the MIT License http://magicdawn.mit-license.org

    Install

    npm i redux-standard-reducer

    DownloadsWeekly Downloads

    8

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • magicdawn