title: How to combine FlatList and if?
body: <p>If the 'unit' value under data(dokuzuncu) equals the condition, I want to redirect it to a different page. I want to redirect it to different pages according to the bold text in the screenshot.Can you help me where is the error in my code?
  <a href="https://i.stack.imgur.com/ZUskh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZUskh.png" alt="enter image description here" /></a></p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import data from './data/dokuzuncu'
  
  export default class dokuz extends React.Component {
      renderContactsItems = ({item,index}) =&gt; {
          return(
              &lt;View style={styles.list}&gt;
                  &lt;TouchableOpacity
                  onPress={() =&gt;  {
                      if (data.unit === 'Madde ve Özellikleri') {
                          const pushAction = StackActions.push('tyt');
                          this.props.navigation.dispatch(pushAction);
                        }
                      else if (data.unit === 'Hareket ve Kuvvet') {
                          const pushAction = StackActions.push('tyt');
                          this.props.navigation.dispatch(pushAction);
                        }
                      else if (data.unit === 'Enerji') {
                          const pushAction = StackActions.push('tyt');
                          this.props.navigation.dispatch(pushAction);
                        }
                      else if (data.unit === 'Isı ve Sıcaklık') {
                          const pushAction = StackActions.push('tyt');
                          this.props.navigation.dispatch(pushAction);
                        }
                      else if (data.unit === 'Elektrostatik') {
                          const pushAction = StackActions.push('tyt');
                          this.props.navigation.dispatch(pushAction);
                        }
                    }}
                  &gt;
                      &lt;Text style={{fontWeight:'bold',fontSize:25}}&gt;{item.unit}&lt;/Text&gt;
                      &lt;Text style={{fontSize:25}}&gt;{item._id}&lt;/Text&gt;
                  &lt;/TouchableOpacity&gt;
              &lt;/View&gt;
          )
      };
  
      render() {
          return (
              &lt;SafeAreaView style={styles.container}&gt;
                  &lt;FlatList
                  keyExtractor={(item) =&gt; item._id}
                  renderItem={this.renderContactsItems}
                  data={data}
                  /&gt;
              &lt;/SafeAreaView&gt;
          )
      }
  }</code></pre>
  </div>
  </div>
  </p>