My FlatList looks like this:
<FlatList
style={styles.scrollView}
data={data}
keyExtractor={({ id }, index) => id}
renderItem={({ item }) => <Item item={item} />}
/>
Item looks like this:
const Item = ({ item }) => {
...
}
I want to pass a parameter (let's say I call it "myParam") to "Item" from FlatList renderItem
CodePudding user response:
<FlatList
style={styles.scrollView}
data={data}
keyExtractor={({ id }, index) => id}
renderItem={({ item }) => <Item item={item} myParam ={data}/>}
/>
const Item = ({ item, myParam }) => {
...
}