Skip to content

Instantly share code, notes, and snippets.

@tfiechowski
Created October 28, 2018 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tfiechowski/6b0ceeb991dc986d74965cedefe57462 to your computer and use it in GitHub Desktop.
Save tfiechowski/6b0ceeb991dc986d74965cedefe57462 to your computer and use it in GitHub Desktop.
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