title: Immutable push/add (redux/immutable.js)
body: <p>I have an immutable object as my state in a redux reducer, and am trying to add/updates objects to a list.</p>
  
  <p><strong>Here's my reducer:</strong></p>
  
  <pre><code>import { fromJS } from 'immutable'
  
  const initialState = fromJS({
    editable: true
  })
  
  export default (state = initialState, action) =&gt; {
    switch(action.type) {
  
      case 'CONTENT_MODE': {
        return state.set('editable', action.editable ? false : true) 
      }
  
      case 'UPDATE_CONTENT': {
        return state.set(action.page, action.content)
        // action.page = String
        // action.content = {}
      }
  
      default: {
        return state
      }
  
    }
  }
  </code></pre>
  
  <p>I want to add objects to the page key, however if it currently exists update the values. I've tried updateIn and add() the callback, but I'm fairly new to immutable.js and am not sure how to approach it correctly.</p>
  
  <p>The set() method rewrites the 'page' value entirely, whilst I need to push the value and only set if it exists, ending up with:</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>const initialState = fromJS({
    editable: true,
    home: {
      title: {
        name: 'this is the name',
        value: 'this is the value'
      },
      body: {
        name: 'this is the name',
        value: 'this is the value'
      }
    },
    page1: {
      title: {
        name: 'this is the name',
        value: 'this is the value'
      },
      body: {
        name: 'this is the name',
        value: 'this is the value'
      }
    }  
  })
  </code></pre>