const Immutable = require('immutable'); import * as MuncherActions from '../../actions/board/muncher.actions'; const initial = { x: 0, y: 0, frozen: false }; const reducer = (state = initial, action) => { if (action.type !== MuncherActions.MUNCHER_ACTION) { return state; } if (action.action === MuncherActions.UPDATE) { return Immutable.Map(state) .set('x', action.x) .set('y', action.y) .toObject(); } return state; }; export default reducer;