create-personal-react-app
Version:
A thin wrapper around Facebook's create-react-app
22 lines (17 loc) • 453 B
JavaScript
import { GET_USERS_SUCCESS } from '../constants/actionTypes';
const INITIAL_STATE = {
users: [],
};
const applySuccessGetUsers = (state, action) => {
const { users } = action.payload;
return { ...state, users };
};
const userReducer = (state = INITIAL_STATE, action) => {
switch (action.type) {
case GET_USERS_SUCCESS:
return applySuccessGetUsers(state, action);
default:
return state;
}
};
export default userReducer;