# fl-redux-utils

> Boilerplate and helper functions for redux that can be shared amongst FounderLab apps

Latest version **11.4.1** (published 2023-11-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install fl-redux-utils
pnpm add fl-redux-utils
yarn add fl-redux-utils
bun add fl-redux-utils
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 11.4.1 |
| Published | 2023-11-19 |
| First published | 2016-06-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 45.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Gwilym Humphreys |
| Maintainers | founderlab |

## Links

- npm: https://www.npmjs.com/package/fl-redux-utils
- Repository: https://github.com/founderlab/frameworkstein.git#master
- Homepage: https://github.com/founderlab/frameworkstein/tree/master#readme
- Issues: https://github.com/founderlab/frameworkstein/issues
- npm.io page: https://npm.io/package/fl-redux-utils

## Dependencies (8)

- [react](https://npm.io/package/react.md) >=16.0.0
- [redux](https://npm.io/package/redux.md) ^4.0.0
- [lodash](https://npm.io/package/lodash.md) ^4.0.0
- [warning](https://npm.io/package/warning.md) ^2.0.0
- [reselect](https://npm.io/package/reselect.md) ^4.0.0
- [immutable](https://npm.io/package/immutable.md) ^3.0.0
- [classnames](https://npm.io/package/classnames.md) ^2.0.0
- [queue-async](https://npm.io/package/queue-async.md) ^1.0.0

## Recent versions

- 11.4.1 (latest) — 2023-11-19
- 1.0.0-alpha.7 (next) — 2017-11-03
- 11.0.0 — 2023-05-11
- 10.1.1 — 2023-03-28
- 10.1.0 — 2023-03-27
- 10.0.0 — 2022-11-24
- 9.0.0 — 2022-07-06
- 9.0.0-rc.6 — 2022-07-05
- 9.0.0-rc.4 — 2022-06-22
- 9.0.0-rc.2 — 2022-06-21
- 7.8.0 — 2022-03-24
- 7.6.22 — 2021-11-04
- 7.6.16 — 2021-10-05
- 7.6.15 — 2021-10-05
- 7.6.14 — 2021-10-01
- … 53 more at https://npm.io/package/fl-redux-utils/versions

## README

# Boilerplate and helper functions for redux that can be shared amongst FounderLab apps

createGroupByReducer
--------------------
Use this to take an action parsed by responseParser and generate a map of lists of model ids grouped by a given key

e.g. here the byLesson property of the state will be a list of file ids that share a lessonId 

```javascript
const byLesson = createGroupByReducer([TYPES.FILE_LOAD + '_SUCCESS'], file => file.lessonId)

...

/*
  state will look like: 
  {
    ...
    byLesson: {
      123: {
        id: 1,
        lessonId: 123
      },
      456: {
        id: 2,
        lessonId: 456
      },
    },
  }
*/
export default function fileReducer(state=defaultState, action={}) {

  switch (action.type) {
    ...

    case TYPES.FILE_LOAD + '_SUCCESS':
      return = state.mergeDeep({
        loading: false,
        error: null,
        byLesson: byLesson(state.get('byLesson'), action),
      })

    ...
  }
}
```


createGroupByReducer
--------------------
Use this to take an action parsed by responseParser and generate a list of model ids grouped by a given key

e.g. here the byLesson property of the state will be a list of file ids that share a lessonId 

```javascript
const byLesson = createGroupByReducer([TYPES.FILE_LOAD + '_SUCCESS'], file => file.lessonId)

...

export default function fileReducer(state=defaultState, action={}) {

  switch (action.type) {
    ...

    case TYPES.FILE_LOAD + '_SUCCESS':
      return = state.mergeDeep({
        loading: false,
        error: null,
        byLesson: byLesson(state.get('byLesson'), action),
      })

    ...
  }
}
```

---
_Source: https://npm.io/package/fl-redux-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
