The result that i want look like
I need help ..
How to implement the logic that lists numbers in a table in the range of 00 – 99 like this using react-native or javascript?
2
Use double For-loop. each loop will be length of 10(0 to 9).
for(let i=0; i< 10; i++){ for(let j=0; j < 10; j++){ console.log(i,j,"i + j") } }
You can do it using FlatList check below code for same.
Working example
import React from 'react'; import { Text, View, StyleSheet, FlatList } from 'react-native'; const items = Array.from({length: 100}, (x, i) => i); export default function App() { return ( <View style={styles.container}> <FlatList numColumns={10} data={items} renderItem={({ item }) => ( <View style={styles.box}> <Text>{item}</Text> </View> )} /> </View> ); } const styles = StyleSheet.create({ container: { alignItems: 'center', flex: 1, justifyContent: 'center', backgroundColor: '#ecf0f1' }, box: { alignItems: 'center', borderWidth: 1, backgroundColor: 'orange', justifyContent: 'center', width: 30 } });
Click here to cancel reply.
2
Answers
Use double For-loop. each loop will be length of 10(0 to 9).
You can do it using FlatList check below code for same.
Working example