title: Updating timer inside render gives warning
body: <p>I know that it gives me a warning because it's not pure. But when I put it in <code>componentDidMount()</code> it doesn't update. It just reduces once.</p>
  
  <p>This is what I have:</p>
  
  <pre><code>class timer extends Component {
    constructor(props) {
      super(props);
  
      this.state = {
        seconds: 900
      };
  
    }
  
    render() {
      setTimeout(() =&gt; {
        if(this.state.seconds &gt; 0){
          this.setState({seconds: this.state.seconds-1})
        }
      }, 1000);
    }
  }
  </code></pre>
  
  <p>How can I update the state somewhere else while still being able to use the <code>setTimeOut()</code> without a warning about that it isn't pure?</p>