I am trying to render multiple cards within a Flatlist, where the number of cards to be rendered is set in state. I don’t know if there is a way to accomplish this since, to my knowledge, Flatlist only takes an array in its data attribute.
Here’s what I’m trying to do:
[numberOfCards, setNumberOfCards] = useState(1)
<FlatList
horizontal
pagingEnabled
showsHorizontalScrollIndicator={false}
data={numberOfCards}
renderItem={({ card }) => {
return (
<Card />
);
}}
/>
New contributor
vintriguna is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.