Closed AmirBraham closed 10 months ago
So the correct way to do it is not to use the index variable that's provided by the map function but to use unique keys for each data image like this :
const [data,setData] = React.useState( [
{src:'https://images.unsplash.com/photo-1681896616404-6568bf13b022?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1335&q=80',key:1}
,
{
src:'https://images.unsplash.com/photo-1681871197336-0250ed2fe23d?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80',
key:2
},
])
I'm going to write swiper inside the library to eliminate this kind of problem, I'm going to remove the TinderCard
component completely and make it available only as swiper @AmirBraham
Hello. I tried following the example in the repo . I used useState to store data and changed onSwipedRight and onSwipedLeft callbacks to update the state. The view gets re-rendered but it's empty Here's my code
I have ommited the imports and styling as that's unrelated to the issue.