Explanation
Wire React/Next.js clients to your APIs with typed fetch helpers, auth headers, and resilient UI states.
Code example
typescriptexport async function getSkills(token?: string) {
const res = await fetch("/api/skills", {
headers: token ? { Authorization: `Bearer ${token}` } : undefined,
cache: "no-store",
});
if (!res.ok) throw new Error("Failed to load skills");
return res.json();
}Helpful resources
Exercise
Connect your Next.js UI to the Express/Next API with loading, empty, and error states.
