collection-reducer
A simple redux reducer generator for managing collections.
Example
; // Consider a standard reducer for your item's stateconst counter = { } // ... and the selectors to access the state's dataconst counterSelectors = state // `collectionReducer` takes a reducer that will be used for each// element in the collection// and a filter on which actions to passconst counterCollection = ; // alternativellyconst counterCollection = ; // Actions passed to this reducer must include an `id` property.// If the individual item's reducer returns `undefined` for a given// action the item is removed from the collection. // The `id` key can be customized by passing a custom id key as a third argument.// collectionReducer(reducer, filter [, customId]) // `itemSelectors` transform each selector for use in the collection adding// an id argument to it.const selectors = ; // Instead of accessing an individual item's state usingcounterSelectors;// you can use the new selector for an item by it's idselectors; // `itemSelector` adds a special selector called `allIds` to get an array// of all item's ids in the collectionselectors;