0
Challenge · 52Routing & Data

Error States

Coreused in ~90% of apps

When a request fails, a blank screen or a spinner that never stops is the worst thing a user can see — they can't tell what broke or what to do. The error state turns a failure into a clear message plus a way out.

Core idea. Treat "error" as a first-class branch of your data state machine: catch the failure, store it in state, then render a dedicated UI that says what went wrong and offers the right recovery — a Retry for transient errors, navigation for a 404.
Playground, this isn't a screenshot
what the user sees
No data yet
press Send request to start
how the code branched
statusidle
error kind—
isRetryable—
Pick a failure to simulate, then send the request.

Same failed request, three different UIs. Classify the error, render a human message, and offer the right recovery — a working Retry for transient network/500 errors, navigation for a 404.

↑ play a little first, then dig in