title: Using requestAnimationFrame in React
body: <p>I am new to react native and I trying to optimize performance. </p>
  
  <p>My Touch events are very slow and I was going through <a href="https://facebook.github.io/react-native/docs/performance#my-touchablex-view-isn-t-very-responsive" rel="noreferrer">RN documentation on performance</a> and they have mentioned to use <strong><code>requestAnimationFrame</code></strong> with this example</p>
  
  <pre><code>handleOnPress() {
    // Always use TimerMixin with requestAnimationFrame, setTimeout and
    // setInterval
    this.requestAnimationFrame(() =&gt; {
      this.doExpensiveAction();
    });
  }
  </code></pre>
  
  <p>Now, this description sounds very vague and hard for me to comprehend its usage </p>
  
  <p>Like, I have this touchable event in my RN app</p>
  
  <pre><code>&lt;TouchableWithoutFeedback   onPress={() =&gt; this.touched(this.props.coinShortName)}&gt;
  </code></pre>
  
  <p>Which calls this method </p>
  
  <pre><code> touched = (id) =&gt; {
  
          this.setState({selectedPostId: id})
          if (this.props.coinShortName == this.state.selectedPostId ) { 
             this.setState({stateToDisplay: !this.state.stateToDisplay})
          }
      }
  </code></pre>
  
  <p><strong>Question:</strong> Can someone please tell me on how I need to/should use it in my app?</p>