Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy
Last active August 15, 2016 18:06
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 codeaholicguy/c411122f6ccc1dda99f0cd57a61a7133 to your computer and use it in GitHub Desktop.
Save codeaholicguy/c411122f6ccc1dda99f0cd57a61a7133 to your computer and use it in GitHub Desktop.
import {ActionTypes} from '../core/constants';
const initialState = [];
export default function(state = initialState, action) {
switch (action.type) {
case ActionTypes.TRACKS_SET:
return setTracks(state, action);
}
return state;
}
function setTracks(state, action) {
const {tracks} = action;
return [...state, ...tracks];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment