Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy

codeaholicguy/track.js

Last active Aug 15, 2016
Embed
What would you like to do?
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