title: How can I convert this object to an array and access values by key in React?
body: <p><strong>I have an Object with a lot of keys. I need to convert this object to an array of objects but in such a way where I can still access the values for each object by the key.</strong></p>
  
  <p><strong>I want to go from:</strong></p>
  
  <pre><code>{'A': 123, 'B': 453, 'C': 4132}
  </code></pre>
  
  <p><strong>To:</strong></p>
  
  <pre><code>[{'A': 123}, {'B': 453}, {'C': 4132}]
  </code></pre>
  
  <p><strong>I want to be able to access the values with a key such as <code>'A'</code> or <code>'B'</code> to return <code>123</code> and <code>453</code> respectively.</strong></p>
  
  <p>I am using Redux and currently my reducer looks like so:</p>
  
  <pre><code>const contextReducer = (state=null, action) =&gt; {
      switch(action.type){
          case 'CONTEXTUALIZE':
              state =  Object.values(action.payload)
              state = state.filter(o =&gt; (o === state[0] || o === state[3]))
              state = Object.assign(...state)
              console.log(state)
              return state
          default:
              return state
      }
  }
  
  export default contextReducer
  </code></pre>
  
  <p>I have tried using <code>Object.values(state)</code> again right before the <code>return</code> but this gives me an array of items like so:</p>
  
  <pre><code>['A', 123, 'B', 453, 'C', 4132]
  </code></pre>