title: How to Update chart in react-chartjs-2?
body: <p>I call the <code>update()</code> function, but it does not work.</p>
  <blockquote>
  <p>TypeError: line.update is not a function.</p>
  </blockquote>
  <p>Why is <code>update()</code> not a function?</p>
  <p>I have seen this example on <a href="http://jsfiddle.net/zpnx8ppb/26/" rel="nofollow noreferrer">http://jsfiddle.net/zpnx8ppb/26/</a> where the update function does work</p>
  <p>Here is my code:</p>
  <pre><code>import React, { Component } from 'react';
  import { Line } from 'react-chartjs-2';
  import Chart from 'chart.js';
  
  const line = {
      labels: [],
      datasets: [
         {
            label: 'My First dataset',
            fill: false,
            data: []
         }
      ]
  };
  
  setInterval(function(){
      line.labels.push(Math.floor(Math.random() * 100));
      line.datasets[0].data.push(Math.floor(Math.random() * 100));
      line.update();
  }, 5000);
  
  class LineChart extends Component {
      render() {
          return (
              &lt;div className=&quot;chart&quot;&gt;
                  &lt;Line
                      data={this.state}
                      height={5}
                      width={20}
                  /&gt;
              &lt;/div&gt;          
          )
      }
  }
  
  export default LineChart;
  </code></pre>