0
Challenge · 51Routing & Data
Loading States
Coreused in ~95% of apps
A blank screen while data loads feels broken; a screen that flashes a spinner then violently reflows feels cheap. The difference between an app that feels fast and one that feels janky is almost entirely how you model and render the four states every async UI moves through.
Core idea. Model async UI as one explicit state machine — status: 'idle' | 'loading' | 'error' | 'success' — render exactly one branch for each, and reserve the final layout (skeletons, not a bare spinner) so content swaps in without shifting the page.
poke it, drag it,
try to break it
try to break it
no slides here.
you drive.
you drive.
Playground, this isn't a screenshot
statusIDLE
→→→
what the user sees
Nothing requested yet
pick a status above
→12 more in your feed
loading indicator
Greyed placeholders shaped like the real content — best for feeds, cards, lists.
SPACE RESERVED
The skeleton is sized to the final layout, so the footer below stays put — zero layout shift.
Every async UI lives in one of four states: idle → loading → error or success. Toggle skeleton vs spinner while in loading to feel the layout shift.
↑ play a little first, then dig in