import * as types from '../actions/ActionTypes';
const initialState = {
number: 0,
dummy: 'dumbdumb',
dumbObject: {
d: 0,
u: 1,
m: 2,
b: 3
}
};
export default function counter(state = initialState, action) {
/* ... */
switch(action.type) {
case types.INCREMENT:
return {
...state,
number: state.number + 1,
dumbObject: { ...state.dumbObject, u: 0 }
};
case types.DECREMENT:
return {
...state,
number: state.number - 1
};
default:
return state;
}
}
import * as types from '../actions/ActionTypes';
const initialState = {
color: [255, 255, 255]
};
export default function ui(state = initialState, action) {
if(action.type === types.SET_COLOR) {
return {
color: action.color
};
} else {
return state;
}
}
import { combineReducers } from 'redux';
import counter from './counter';
import ui from './ui';
const reducers = combineReducers({
counter, ui
});
export default reducers;