title: Refresh react component
body: <p>My node.js server sends with socket.io new data each 10s. In my web application I update this.state each time that my server sends data and force to update with forceUpdate()</p>
  
  <p>However, my react component doesn't refresh, I don't know why. I followed the doc but I missed something...</p>
  
  <p><strong>Parent :</strong></p>
  
  <pre><code>class DataAnalytics extends React.Component {
    constructor(props) {
      super(props);
      socket = this.props.socket;
      this.state = {data: []};
  
      socket.on('dataCharts', (res) =&gt; {
        console.log("new data charts : "+res);
        var data = JSON.parse(res);   
        this.setState({data: data});
        this.forceUpdate();
      });
    }
  
    componentWillUnmount() {
      socket.off('dataCharts');
    }
  
    render() {
      return (
      &lt;div id="dataAnalytics"&gt;
        &lt;Stats data={this.state.data}&gt;&lt;/Stats&gt;
      &lt;/div&gt;
      );
    }
  }
  
  export default DataAnalytics;
  </code></pre>
  
  <p><strong>Child :</strong></p>
  
  <pre><code>class Stats extends React.Component {
    constructor(props) {
      super(props);
    }
  
    render() {
      return (
        &lt;div className="stats" style={{textAlign:'center'}}&gt;
          &lt;h4&gt;Number: &lt;/h4&gt;
        &lt;/div&gt;
      );
    }
  
    componentDidUpdate() {
      var data = this.props.data;
  
      if(!jQuery.isEmptyObject(data)) {
        $( ".stats" ).html("&lt;h4&gt;Number : data['nb']['counterIn']&lt;/h4&gt;");
      }
    }
  }
  
  export default Stats;
  </code></pre>
  
  <p>Anyone know how to refresh automatically my React component.</p>