Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Immutable = require('immutable');
- var deepFreeze = require('deep-freeze');
- import * as types from '../actions/actionTypes';
- const initialState = {
- customBackgroundColour: '#f7f7f7'
- };
- export default function backgroundColour(state = initialState, action = {}) {
- switch (action.type) {
- case types.SET_BACKGROUND_COLOUR:
- deepFreeze(state);
- deepFreeze(action);
- console.log(Object.isFrozen(state)); // true
- console.log(state.customBackgroundColour); // #f7f7f7
- state.customBackgroundColour = 'red';
- console.log(state.customBackgroundColour); // red
- return {
- ...state,
- customBackgroundColour: action.payload.colour
- };
- default:
- return state;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement