React-Redux complex (deep) state objects
<p>Given my initial redux state is :</p>

<pre><code>const state = {
  currentView: 'ROOMS_VIEW',
  navbarLinks: List([
    {name: 'Rooms', key: 'ROOMS_VIEW'},
    {name: 'Dev', key: ''}
  ]),
  roomListsSelected: {group: 0, item: 0},
  roomLists: [
    {
      name: "Filters",
      expanded: true,
      listItems: [
        { icon: 'images/icon-warning.svg', name: 'Alerts', filter: room =&gt; room.hasAlert },
        { icon: 'images/icon-playlist.svg', name: 'In Progress', filter: room =&gt; room.progress &gt; 20 },
        { icon: 'images/icon-playlist.svg', name: 'Almost Done', filter: room =&gt; room.progress &gt; 90 },
        { icon: 'images/icon-playlist.svg', name: 'Complete', filter: room =&gt; room.status === 'complete' },
        { icon: 'images/icon-playlist.svg', name: 'Recently Completed', filter: room =&gt; false },
        { icon: 'images/icon-playlist.svg', name: 'All Rooms', filter: room =&gt; true }
      ]
    }
  ],
  rooms: List(generateRooms())
}
</code></pre>

<p>I need to make a reducer that does this:</p>

<pre><code>state.roomList[n].expanded = !state.roomList[n].expanded
</code></pre>

<p>I am new to using a Redux workflow and the best way to solve this is to make roomList an immutable.js object or write some code to make a deep clone of my state object.</p>

<p>Also state.roomList will have new data pushed to it from future features.</p>

<p><strong>Summery / Question:</strong> What is the best way to return a new state object in a reducer when making changes like this deep in the state, or should I change the structure of the Redux state object?</p>

<p><strong>What I did</strong> In the end Immutable seems the way to go. There are some tricks with Immutable to reduce react rendering time and it meets all the project requirements. Also it is early enough in the project to use a new library without making major changes.</p>