Created
October 28, 2018 23:45
-
-
Save tfiechowski/6b0ceeb991dc986d74965cedefe57462 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { ADD_PHOTOS } from './actions'; | |
function getInitialState() { | |
return { | |
photos: [], | |
}; | |
} | |
export default function reducer(state = getInitialState(), action) { | |
switch (action.type) { | |
case ADD_PHOTOS: | |
return Object.assign({}, { photos: [...state.photos, ...action.payload] }); | |
default: | |
return state; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment