Created
September 4, 2015 09:22
-
-
Save janusch/8e50fc205b2d0a9448f6 to your computer and use it in GitHub Desktop.
reducer add to object in object array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case GET_USERS: | |
return [...action.payload]; | |
//payload looks like: [{id: 1, name: blah, age: 30}{id: 2, name: blub, age: 20}] | |
case GET_USER_PROPS: | |
//payload looks like: {prop1: foo, prop2: bar, ...} | |
//i tried this, with lodash merge, but as expected that creates a new object, whereas i want an array of objects. | |
return merge({}, state, action); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment