Skip to content

Instantly share code, notes, and snippets.

@panvourtsis
Created June 9, 2017 18:14
Show Gist options
  • Save panvourtsis/f782700d6f5f74cafd2c0a7fa5305960 to your computer and use it in GitHub Desktop.
Save panvourtsis/f782700d6f5f74cafd2c0a7fa5305960 to your computer and use it in GitHub Desktop.
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