Skip to content

Instantly share code, notes, and snippets.

@shotaK
Last active November 23, 2016 20:42
Show Gist options
  • Save shotaK/07b3740d162c22c96a80a126460d8b65 to your computer and use it in GitHub Desktop.
Save shotaK/07b3740d162c22c96a80a126460d8b65 to your computer and use it in GitHub Desktop.
Redux Immutable JS
import {
ACTIVATE_LOCATION
} from './actions';
import Immutable from 'immutable';
let initialState = Immutable.Map([]);
export let ui = (state = initialState, action) => {
switch (action.type) {
case ACTIVATE_LOCATION:
state = state.set('activeLocationId', action.id);
break;
}
return state;
};
import {
ACTIVATE_LOCATION
} from './actions';
import { Map } from 'immutable';
const initialState = Map({})
export let ui = (state = initialState, action) => {
switch (action.type) {
case ACTIVATE_LOCATION:
return state.set('activeLocationId', action.id);
default:
return state;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment