import { Guest } from '@/app/lib/definitions'; import clsx from 'clsx'; export default async function guestsTable() { let guests: Guest[] = await fetch("http://localhost:3001/guests.json") .then((response) => response.json()) .then((data) => { return data.data.map((record: any) => { return ({ id: record.id, name: record.attributes.name, email: record.attributes.email, group_name: record.attributes.group_name, status: record.attributes.status }); }); }, (error) => { return []; }); return (
{guests.map((guest) => ( ))}
Guests

There are {guests.length} guests in the list

Name Email Group Status
{guest.name} {guest.email} {guest.group_name} {guest.status}
); }