published fresh until

React: how do I handle empty, loading and error states in lists?

Summary When a React list or table has blank loading, empty, or error screens, add clear placeholders and next steps and avoid flashing empty rows during filter changes. Retry after a failed fetch has no tested answer yet.

Not for filtered search page, see case-search-page-url-filters-infinite-scroll-nextjs; records table with export, see case-expense-table-nextjs-supabase-filters-sort-csv-export

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

The case

Your list or table looks fine with data, but shows a blank area while loading, nothing when empty, and a vague message on failure. Success looks like: a skeleton or placeholder while loading, a helpful empty screen that says what to do next, an error screen that says what happened and lets people retry, and no flash of empty rows when filters change. Stack: React, with Next.js and shadcn/ui examples.

This is a map, not new advice: every row points to an existing WhatWorks thread. Nobody here ran this whole build; the Status column says what each linked thread rests on. "Tried" would need a linked trial report, and none of the linked threads has one yet.

Parts, in the order people do them

PartWhat to useStatusLink
Make the agent cover all three statesPrompt and reference for empty, loading, errorDocumented: vendor or primary source, not tried (no linked trial)How do I make my agent handle empty, loading and error states?
Skeletons and error pagesNext.js loading and error files, shadcn skeleton and empty componentDocumented: vendor or primary source, not tried (no linked trial)How do I add loading skeletons and error pages in Next.js?
While filters refetchKeep old rows, show a pending stateDocumented: vendor or primary source, not tried (no linked trial)How should a data table look while it refetches new filters?
Wording of empty and error messagesSpecific, non-robotic copyDocumented: vendor or primary source, not tried (no linked trial)How do I fix robotic empty-state and error messages in AI-built UI?
Retry button, offline and partial-failure screensNo tested answer yetNo tested answer yetnone (see open request)

Where it breaks

Open questions

  • Parts marked "No tested answer yet" are gaps in WhatWorks; ask for them with the request tool so an editor can look: retry and offline handling for a failed list fetch.

Sources

Each linked WhatWorks thread cites its own primary sources; this page adds none of its own. Status labels were checked against the linked thread pages on 2026-11-15.

As of October 2026. a filtered search page with endless scrolling, see case-search-page-url-filters-infinite-scroll-nextjs; a records table with export, see case-expense-table-nextjs-supabase-filters-sort-csv-export.

Started from a post by @WhatWorks editors, packaged by the editor.

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# React: how do I handle empty, loading and error states in lists?
Summary: When a React list or table has blank loading, empty, or error screens, add clear placeholders and next steps and avoid flashing empty rows during filter changes. Retry after a failed fetch has no tested answer yet.
Copy for agent
get the whatworks thread case-empty-loading-error-states-lists-tables-react and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread case-empty-loading-error-states-lists-tables-react
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp