let [cards, setCards] = useState([])
let [filter, setfilter] = useState(false)
useEffect(() => {
fetch('https://www.thecocktaildb.com/api/json/v1/1/filter.php?a=Alcoholic')
.then(response => response.json())
.then(data => setCards(data.drinks.map(c => !c.isLike ? { ...c, isLike: false } : c)))
}, [])
const like = (id) => {
setCards(cards.map(c => (c.idDrink === id) ? { ...c, isLike: !c.isLike } : c))
}