import React, { useEffect, useState } from 'react';

type User = { id: string; name: string };

async function fetchUsers(): Promise<User[]> {

const res = await fetch('/api/users');

if (!res.ok) throw new Error(`HTTP ${res.status}`);

return res.json();

}

export default function Unimate() {

const [users, setUsers] = useState<User[]>([]);

useEffect(() => { fetchUsers().then(setUsers).catch(console.error); }, []);

return (<ul>{users.map(u => <li key={u.id}>{u.name}</li>)}</ul>);

} // unimate: reliable apps for campuses

We're Launching Soon

Learn More