paddockpass/react/13/songs/src/reducers/index.js
Christopher Talib 44a6c7716a starting 13
2019-11-25 17:41:44 +01:00

36 lines
609 B
JavaScript

import { combineReducers } from "redux";
const songReducer = () => {
return [
{
title: "No Scrubs",
duration: "4:05"
},
{
title: "Macarena",
duration: "2:30"
},
{
title: "All star",
duration: "4:45"
},
{
title: "I want it that way",
duration: "2:10"
}
];
};
const selectedSongReducer = (selectedSong = null, action) => {
if (action.type === "SONG_SELECTED") {
return action.payload;
}
return selectedSong;
};
export default combineReducers({
songs: songReducer,
selectedSongReducer: selectedSongReducer
});