Fetching data from an API - automatic updating within react.js
<p>I'm currently fetching data from an API - in json format. This API is updated every hour - is there any way I can automatically update this data when the API updates? I'm currently using,</p>

<pre><code>  componentDidMount() {
    var component = this;
    var MY_ACCESS_KEY  = "REDACTED FOR PRIVACY REASONS";
    var MY_CHOSEN_CURRENCIES = "USD,JPY,CAD,RUB,CNY,GBP,EUR,BTC,CHF"
      $.get("http://apilayer.net/api/live?access_key=" + MY_ACCESS_KEY + "&amp;currencies=" + MY_CHOSEN_CURRENCIES + "&amp;format=1", function(data) {
        component.setState(data)
      });
  }
</code></pre>

<p>within my react component class. This is within the extends React.Component method - if that makes a subtle difference, e.g.:</p>

<pre><code>class TickerTrader extends React.Component {
  constructor(props) {
    super(props);
    this.state = {};
  }

  componentDidMount() {...

  }
</code></pre>