import React, {useState} from 'react'; import TinderCard from 'react-tinder-card' const db = [ { name: 'Richard Hendricks', url: './img/richard.jpg' }, { name: 'Erlich Bachman', url: './img/erlich.jpg' }, { name: 'Monica Hall', url: './img/monica.jpg' }, { name: 'Jared Dunn', url: './img/jared.jpg' }, { name: 'Dinesh Chugtai', url: './img/dinesh.jpg' } ] const Tinder = ()=> { const characters = db const [lastDirection, setLastDirection] = useState() const swiped = (direction, nameToDelete) => { console.log('removing: ' + nameToDelete) setLastDirection(direction) } const outOfFrame = (name) => { console.log(name + ' left the screen!') } return (

React Tinder Card

{characters.map((character) => swiped(dir, character.name)} onCardLeftScreen={() => outOfFrame(character.name)}>

{character.name}

)}
{lastDirection ?

You swiped {lastDirection}

:

}

) } export default Tinder;