redux - how to store and update a key/value pair
<p>I am using redux wth reactjs.</p>

<p>I want to store simple key/value pairs but can't get the reducer syntax right.</p>

<p>In this case each key/value pair will hold a connection to an external system.</p>

<p>Is this the right way to do it?  I'm at the beginning with redux so it's a bit of mystery.</p>

<pre><code>export default (state = {}, action) =&gt; {
  switch(action.type) {
    case 'addConnection':
      return    {
        connections: {
          ...state.connections, {
          action.compositeKey: action.connection
        }
      }

    default:
      return state
  }
}
</code></pre>