title: React: get state data in parent component
body: <p>I have 2 react components. in the child component i have a <code>textfield</code>:</p>
  
  <pre><code>var React = require('react');
  var  UserInput = React.createClass({
    getInitialState: function() {
      return {ItemTotype: ''};
    },
  
  
     handleUserInput: function(e){
      // console.log(e.target.value);
       this.setState({ItemTotype: e.target.value});
     },
  </code></pre>
  
  <p>As you can see, I am tring to update state of application every time user type something in the textbox.</p>
  
  <p>And then i would like to get inserted data into the state in my parent component.</p>
  
  <p>and to do this i used
  `<strong>In parent component (Root)</strong>:</p>
  
  <pre><code>console.log(this.state.data);
  </code></pre>
  
  <p>but it only gives me a <code>[]</code>. I also tried  <code>console.log(this.state.data.ItemTotype);</code> but this time it was <code>undefine</code>.</p>
  
  <p>What should i do?</p>
  
  <p>paernt component is:</p>
  
  <pre><code>define(["./Statistic","./UserInput","./RandomWords","react", "react-dom"],
    (Statistic,UserInput,RandomWords,React, ReactDOM) =&gt; {
  
        var Root = React.createClass({
  
      loadItemTypedFromServer: function() {
        console.log("Hey");
        console.log(this.state.ItemTotype);
  
       },
  
       getInitialState: function() {
         return {data: []};
       },
  
       componentDidMount: function() {
         this.loadItemTypedFromServer();
         setInterval(this.loadItemTypedFromServer, 1000);
       },
  
          render: function() {
            return (
              &lt;div &gt;
                &lt;h1&gt;Welcome to our game&lt;/h1&gt;
                &lt;RandomWords/&gt; 
                &lt;UserInput  /&gt;
                &lt;Statistic/&gt;
              &lt;/div&gt;
            );
          }
        });
  
        ReactDOM.render(
          React.createElement(Root, null),
          document.getElementById('content')
        );
  });
  </code></pre>