Created
June 9, 2017 18:14
-
-
Save panvourtsis/f782700d6f5f74cafd2c0a7fa5305960 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ADD_RATINGS } from "./RatingsActions"; | |
const initialState = { list: [] }; | |
const RatingsReducer = (state = initialState, action) => { | |
switch (action.type) { | |
case ADD_RATINGS : | |
return { | |
...state, | |
list: action.ratings, | |
}; | |
default: | |
return state; | |
} | |
}; | |
/* Selectors */ | |
// Get all ratings | |
export const getRatings = state => state.Ratings.list; | |
// Export Reducer | |
export default RatingsReducer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment