Question from the React Native (Legacy) test

Explain the difference between ListView and FlatList in React Native.

Hard

Consider the following code:

import React from 'react'
import { View, Text, FlatList } from 'react-native'

const titles = [
	{ title: 'title 1', key: 'i1' },
	{ title: 'title 2', key: 'i2' },
	...
]

const _keyExtractor = (item, index) => item.key

const ListComponent1 = () => (
	<View>
		{titles.map(item => <Text key={item.key}>{item.title})}
	</View>
)

const ListComponent2 = () => (
	<FlatList
  		data={titles}
  		keyExtractor={_keyExtractor}
  		renderItem={({item}) => <Text title={item.title} />}
	/>
)

What are the true statements?

Author: Victor SabatierStatus: PublishedQuestion passed 416 times
Edit
0
Community EvaluationsNo one has reviewed this question yet, be the first!