Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React Native, creating a if loop inside a return

$
0
0

I want to create an if loop inside my Flatlist return so that each time a new Flatlist is called, my 'pass' will go back to 0Here is my code:

<FlatList                    data={letter.description}                    numColumns={2}                    keyExtractor={(_, index) => index.toString()}                    renderItem={({ item }) => {                      return (                        //if (pass>letter.description?.length) {                        //pass=0;                        //}<View><Text                            style={{                              fontSize: 18,                              fontWeight: "600",                              marginTop: 25,                              width: "50%",                            }}>                            {letter.data[pass]}                            {"\n"}</Text><Text style={{ marginTop: 50, width: "50%" }}>                            {letter.description[pass]}                            {pass++}                            {"\n"}</Text></View>                      );                    }}                  />

How do I do it?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>