Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy
Created April 5, 2017 19:28
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/174a073c407d2d4464edc6a6fdc2cbb4 to your computer and use it in GitHub Desktop.
Save codeaholicguy/174a073c407d2d4464edc6a6fdc2cbb4 to your computer and use it in GitHub Desktop.
import {ActionTypes} from '../core/constants';
const initialState = {
tracks: [],
activeTrack: null
};
export default function(state = initialState, action) {
switch (action.type) {
case ActionTypes.TRACK_PLAY:
return setActiveTrack(state, action)
}
return state;
}
function setActiveTrack(state, action) {
const {track} = action;
return {...state, activeTrack: track};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment