title: ReactJS - setState of Object key in Array
body: <p>So i've been working on this for awhile and felt it would be best to refactor my code so that the state is set up as an array of objects.  What i'm trying to do is increment a number on a button click.  </p>
  
  <p>I have a callback function in a component that triggers a function to update the state...however i'm having difficulty targeting the key value within the object.  </p>
  
  <p>My initial state looks like this:</p>
  
  <pre><code>getInitialState: function() {
      return {
        items: [
          {
            links: 'zest',
            trackId: 1023,
            songTitle: 'z know the others',
            artist: 'zuvet',
            upVotes: 0
          },
          {
            links: 'alpha',
            trackId: 987,
            songTitle: 'ass',
            artist: 'arme',
            upVotes: 3
          },
        ]
      }
  </code></pre>
  
  <p>I am trying to target the <code>upVotes</code> key, but can't figure out how.  My function passes a key so that I can target the index in the array, but when I try to do something like: <code>this.setState({items[key]: {upVotes: this.state.items[key].upVotes + 1}})</code> it throws an error due to the unexpected <code>[</code> token.  </p>
  
  <p>I have tried something similar to this thread <a href="https://stackoverflow.com/questions/29537299/react-how-do-i-update-state-item1-on-setstate-with-jsfiddle">here</a>, but I keep getting errors.  </p>
  
  <p>What kind of function can I write that will setState of just the key in the object that I want to target? </p>