“Flatlist React Native KeyExtractor” Code-Antworten

So verwenden Sie Flatlist KeyExtractor

<FlatList 
  data={[{name: 'a'}, {name: 'b'}]} 
  renderItem={
    ({item}) => <Text>{item.name}</Text>
  } 
  keyExtractor={(item, index) => index.toString()}
/>
Excited Eland

Flatlist React Native KeyExtractor

keyExtractor = () => {
    return new Date().getTime().toString() + (Math.floor(Math.random() * Math.floor(new Date().getTime()))).toString();  };
Cloudy Chinchilla

Flatlist React Native KeyExtractor

keyExtractor = item => {
    return item.id.toString() + new Date().getTime().toString() + (Math.floor(Math.random() * Math.floor(new Date().getTime()))).toString();  };
Cloudy Chinchilla

Ähnliche Antworten wie “Flatlist React Native KeyExtractor”

Fragen ähnlich wie “Flatlist React Native KeyExtractor”

Weitere verwandte Antworten zu “Flatlist React Native KeyExtractor” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen