title: Do something once, then every 15 seconds in react js
body: <p>I have the following code:</p>
  
  <pre><code>var Panel = React.createClass({
  
    getInitialState: function () {
      return {
        user_id: null,
        blogs: null,
        error: false,
        error_code: '',
        error_code: ''
      };
    },
  
    shouldComponentUpdate: function(nextProps, nextState) {
      if (nextState.error !== this.state.error ||
          nextState.blogs !== this.state.blogs ||
          nextState.error_code !== this.state.error_code
        ) {
        return true;
      }
    },
  
    componentDidMount: function() {
      var self = this;
      var pollingInterval = setInterval(function() {
        $.get(self.props.source, function(result) {
          if (self.isMounted()) {
            self.setState({
              error: false,
              error_code: '',
              error_message: '',
              blogs: result.user.blogs,
              user_id: result.user.id
            });
          }
        }.bind(self)).fail(function(response) {
          self.setState({
            error: true,
            error_code: response.status,
            error_message: response.statusText
          });
        }.bind(self));
      }, 1000);
    },
  
    render: function() { ... }
  
  });
  </code></pre>
  
  <p>The important part to focus on is the <code>componentDidMount</code> This will fetch every second, regardless if there is an error or not. The render function, assuming theres an error, will display the appropriate method. So for all intense and purpose, this code does exactly what I want it to do, it fetches, if it fails, it fetches again until it succeeds.</p>
  
  <p>But I need to make some changes, and this is where I am lost. I want to say: <strong>Fetch once, pass or fail - it doesn't matter. THEN every 15 seconds after that initial fetch, try again - regardless of pass or fail</strong></p>
  
  <p>I would normally spin up a backbone collection and router along with a poll helper to do all this, but in this specific case there is no need for the extra overhead. So thats where I am stumped. <strong>How do I accomplish what I am trying to achieve</strong>?</p>