'use client'; import clsx from 'clsx'; import React, { useState, useEffect } from 'react'; import { Guest } from '@/app/lib/definitions'; export default function guestsTable() { function loadGuests() { 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, group_name: record.attributes.group_name, status: record.attributes.status }); })); }, (error) => { return []; }); } const [guests, setGuests] = useState>([]); guests.length === 0 && loadGuests(); return (
{guests.map((guest) => ( ))}
Guests

There are {guests.length} guests in the list

Name Email Group Status Actions
{guest.name} {guest.email} {guest.group_name} {guest.status} {guest.status === 'Considered' && ()}
); }