import React, { useState, useEffect } from 'react'; import { Link } from 'react-router-dom'; import Layout from './Layout'; import { getCart } from './cartHelpers'; import Card from './Card'; import Checkout from './Checkout'; const Cart = () => { const [items, setItems] = useState([]); const [run, setRun] = useState(false); useEffect(() => { setItems(getCart()); }, [run]); const showItems = items => { return (

You have {`${items.length}`} Dream destination.

{items.map((product, i) => ( ))}
); }; const noItemsMessage = () => (

Your Wishlist is empty.

Look for places to visit

); return (
{items.length > 0 ? showItems(items) : noItemsMessage()}

Your cart summary


); }; export default Cart;