title: React.js: Unable to setState
body: <p>Normally in React.js, if I call <code>this.setState({data: newData})</code>, <code>this.state.data</code> is set to <code>newData</code> and the entire component is rendered again. </p>
  
  <p>In my code, I have a search bar. When I press enter, I want to set the search_term to the entered keyword. </p>
  
  <pre><code>if (evt.keyCode == 13) {
      this.setState({search_term: keyword})
  }
  </code></pre>
  
  <p>The keyword is "dog" and evt.keyCode is 13 directly before this (I printed it out). I am reaching the setState call. However, I am getting an error:</p>
  
  <pre><code>Uncaught TypeError: Can't add property framesToPop, object is not extensible.
  </code></pre>
  
  <p>This is causing the setState call to fail and thus, doesn't set the state of the component or re-render the component to show the new search term on the page (assuming I am printing out search_term inside my render function). </p>
  
  <p>Any ideas on how to debug? What might be happening? I can provide more information if necessary, just let me know! :)</p>
  
  <p>[Edit]</p>
  
  <p>This is the code the console brings me to for framesToPop</p>
  
  <pre><code>/**
  * Use invariant() to assert state which your program assumes to be true.
  *
  * Provide sprintf-style format (only %s is supported) and arguments
  * to provide information about what broke and what you were
  * expecting.
  *
  * The invariant message will be stripped in production, but the invariant
  * will remain to ensure logic does not differ in production.
  */
  
  var invariant = function(condition, format, a, b, c, d, e, f) {
    if ("production" !== "development") {
      if (format === undefined) {
        throw new Error('invariant requires an error message argument');
      }
    }
  
  if (!condition) {
      var error;
      if (format === undefined) {
        error = new Error(
          'Minified exception occurred; use the non-minified dev environment ' +
          'for the full error message and additional helpful warnings.'
        );
      } else {
        var args = [a, b, c, d, e, f];
        var argIndex = 0;
        error = new Error(
          'Invariant Violation: ' +
          format.replace(/%s/g, function() { return args[argIndex++]; })
        );
      }
  
      error.framesToPop = 1; // we don't care about invariant's own frame
      throw error;
    }
  };
  </code></pre>