[{"a": 1000}, {"b": 2000}, {"c": 3000}, {"d": 4000}, {"e": 6000}, {"f": 7000}]
Using this data I want to make a list in react-native application like
a 1000
b 2000
c 3000
d 4000
e 5000
f 6000
Thanks in advance
[{"a": 1000}, {"b": 2000}, {"c": 3000}, {"d": 4000}, {"e": 6000}, {"f": 7000}]
Using this data I want to make a list in react-native application like
a 1000
b 2000
c 3000
d 4000
e 5000
f 6000
Thanks in advance
Try this way
import React from 'react';
import { SafeAreaView, View, FlatList, StyleSheet, Text, StatusBar } from 'react-native';
const DATA = [{"a": 1000}, {"b": 2000}, {"c": 3000}, {"d": 4000}, {"e": 6000}, {"f": 7000}];
const App = () => {
const renderItem = ({ item }) => {
const key = Object.keys(item);
const value = Object.values(item);
return (
<View style={{flexDirection:"row"}}>
<Text>{key[0]}</Text>
<Text>{value[0]}</Text>
</View>
);
}
return (
<FlatList
data={DATA}
renderItem={renderItem}
keyExtractor={(item, index) => index.toString()}
/>
);
}