11.4.1 • Published 2 years ago

fl-redux-utils v11.4.1

Weekly downloads
8
License
MIT
Repository
github
Last release
2 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

2 years ago

11.0.0

2 years ago

10.1.0

2 years ago

10.1.1

2 years ago

10.0.0

3 years ago

9.0.0-rc.6

3 years ago

9.0.0-rc.4

3 years ago

9.0.0-rc.2

3 years ago

9.0.0

3 years ago

7.8.0

3 years ago

7.6.22

4 years ago

7.6.15

4 years ago

7.6.16

4 years ago

7.6.14

4 years ago

7.4.17

5 years ago

7.4.13

5 years ago

7.4.5

5 years ago

7.4.4

5 years ago

7.4.3

5 years ago

7.4.1

5 years ago

7.4.0

5 years ago

7.3.4

5 years ago

7.3.3

5 years ago

7.3.1

5 years ago

7.2.4

5 years ago

7.2.3

5 years ago

7.2.2

5 years ago

7.2.1

5 years ago

7.2.0

5 years ago

7.1.3

5 years ago

7.0.23

6 years ago

7.0.17

6 years ago

7.0.8

6 years ago

7.0.6

6 years ago

7.0.0

6 years ago

6.18.2

6 years ago

6.16.0

6 years ago

6.11.0

6 years ago

6.9.1

6 years ago

6.7.6

7 years ago

6.0.1

7 years ago

6.0.0

7 years ago

5.0.3

7 years ago

5.0.1

7 years ago

5.0.0

7 years ago

4.0.16

7 years ago

1.0.0

8 years ago

1.0.0-alpha.7

8 years ago

1.0.0-alpha.6

8 years ago

1.0.0-alpha.5

8 years ago

1.0.0-alpha.4

8 years ago

1.0.0-alpha.3

8 years ago

1.0.0-alpha.2

8 years ago

1.0.0-alpha.1

8 years ago

0.5.0

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.1

9 years ago

0.3.0

9 years ago

0.2.2

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago