How to properly handle loading/error/empty states?
Answer
•Show skeleton/spinner for loading.
•For error — clear message + retry.
•For empty — separate UI and CTA.
•Don't mix data fetching logic and display.
•Keep state explicit (discriminated union).
Was this answer helpful?