title: Countdown timer in react-native
body: <p>I want to countdown from 3 to 1 when a screen is loaded in react-native. I tried it with setTimeOut like this and it didn't work. What am I doing wrong here? How can I achieve this? When the screen is loaded, I want to show 3 =-> 2 ==> 1 with 1 second interval. Here is my code.</p>
  
  <pre><code> constructor(props) {
          super(props);
  
          this.state = {
              timer: 3
          }
      }
  
      // componentDidMount 
      componentDidMount() {
          setTimeout(() =&gt; {
              this.setState({
                  timer: --this.state.timer
              })
          }, 1000);
      }
  </code></pre>