11.4.1 • Published 3 years ago

fl-redux-utils v11.4.1

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

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

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

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),
      })

    ...
  }
}
11.4.1

3 years ago

11.0.0

3 years ago

10.1.0

3 years ago

10.1.1

3 years ago

10.0.0

4 years ago

9.0.0-rc.6

4 years ago

9.0.0-rc.4

4 years ago

9.0.0-rc.2

4 years ago

9.0.0

4 years ago

7.8.0

4 years ago

7.6.22

5 years ago

7.6.15

5 years ago

7.6.16

5 years ago

7.6.14

5 years ago

7.4.17

6 years ago

7.4.13

6 years ago

7.4.5

6 years ago

7.4.4

6 years ago

7.4.3

6 years ago

7.4.1

6 years ago

7.4.0

6 years ago

7.3.4

6 years ago

7.3.3

6 years ago

7.3.1

6 years ago

7.2.4

6 years ago

7.2.3

6 years ago

7.2.2

6 years ago

7.2.1

6 years ago

7.2.0

6 years ago

7.1.3

6 years ago

7.0.23

7 years ago

7.0.17

7 years ago

7.0.8

7 years ago

7.0.6

7 years ago

7.0.0

7 years ago

6.18.2

7 years ago

6.16.0

7 years ago

6.11.0

7 years ago

6.9.1

7 years ago

6.7.6

8 years ago

6.0.1

8 years ago

6.0.0

8 years ago

5.0.3

8 years ago

5.0.1

8 years ago

5.0.0

8 years ago

4.0.16

8 years ago

1.0.0

9 years ago

1.0.0-alpha.7

9 years ago

1.0.0-alpha.6

9 years ago

1.0.0-alpha.5

9 years ago

1.0.0-alpha.4

9 years ago

1.0.0-alpha.3

9 years ago

1.0.0-alpha.2

9 years ago

1.0.0-alpha.1

9 years ago

0.5.0

9 years ago

0.4.3

9 years ago

0.4.2

9 years ago

0.4.1

9 years ago

0.4.0

9 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago