'use client' import { Guest } from '@/app/lib/definitions'; import { useState, Suspense, useEffect } from 'react'; export default function guestsTable() { const [guests, setGuests] = useState([]); useEffect(() => { if (guests.length > 0) { return; } fetch("http://localhost:3001/guests.json") .then((response) => response.json()) .then((data) => { setGuests(data.data.map((record: any) => { return ({ id: record.id, name: record.attributes.name, email: record.attributes.email, }); })) }); }); return (

There are {guests.length} guests in the list

{guests.map((guest) => ( ))}
Name Email Status
{guest.name} {guest.email} Confirmed
); }