1.0.0 • Published 7 years ago

weeflux-partial-reducer v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

weeflux-partial-reducer

A partital reducer creator for weeflux

import flux from 'weeflux';
import partial from 'weeflux-partial-reducer';

// reducer for text prop
flux(partial('text', actions.textChanged, (state, { payload }) => payload));

flux(
  partial(
    // reducer for profile prop
    'profile',
    // handle multiple actions with one reducer
    [actions.profileLoaded, actions.profileFailed, actions.profileLoading],
    (state, { payload }) => payload
  )
);