Problem:
Hi I'm a beginner in React JS, I was Following a YouTube Tutorial on making a Tinder Clone. I followed the exact steps but still got this error and I'm stuck here. I have searched almost everywhere but cant figure out what is the issue.
Solutions I've tried:
- Updating all packages
- Reinstalling react-tinder-cards
- Read other questions related to this issue.
but still confused what the issue is
Code:
import React, { useState } from 'react'
import TinderCard from 'react-tinder-card'
import "./TinderCards.css"
function TinderCards() {
const [people, setPeople] = useState([
{
name: "Elon Musk",
url: 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/85/Elon_Musk_Royal_Society_%28crop1%29.jpg/220px-Elon_Musk_Royal_Society_%28crop1%29.jpg'
},
{
name: "Jeff Bezos",
url: 'https://en.wikipedia.org/wiki/File:Jeff_Bezos_at_Amazon_Spheres_Grand_Opening_in_Seattle_-_2018_(39074799225)_(cropped).jpg'
},
])
const swiped = (direction, nameToDelete) => {
console.log("removing: " + nameToDelete)
// setLastDirection(direction)
}
const outOfFrame = (name) => {
console.log(name + "left the screen!")
}
return (
<div className="tinderCards">
<div className="tinderCards__cardContainer">
{people.map((person) => (
< TinderCard
className="swipe"
key={person.name}
preventSwipe={["up", "down"]}
onswipe={(dir) => swiped(dir, person.name)}
onCardLeftScreen={() => outOfFrame(person.name)}
></TinderCard>
))}
</div>
</div>
)
}
export default TinderCards
Error:
Solved ✅
The error is fixed. Just restarted the project next day and the error vanished. I would like to thank you all very much for trying to help me by devoting your valuable time in writing these comments.