title: Whats the best way to update an object in an array in ReactJS?
body: <p>If you have an array as part of your state, and that array contains objects, whats an easy way to update the state with a change to one of those objects?</p>
  
  <p>Example, modified from the tutorial on react:</p>
  
  <pre><code>var CommentBox = React.createClass({
    getInitialState: function() {
      return {data: [
        { id: 1, author: "john", text: "foo" },
        { id: 2, author: "bob", text: "bar" }
      ]};
    },
    handleCommentEdit: function(id, text) {
      var existingComment = this.state.data.filter({ function(c) { c.id == id; }).first();
      var updatedComments = ??; // not sure how to do this  
  
      this.setState({data: updatedComments});
    }
  }
  </code></pre>