Return a status object from custom data hooks.
Section: Data Fetching Patterns
Expose derived async status
tsx
tsx
return {
data,
error,
loading,
isEmpty: !loading && !error && Array.isArray(data) && data.length === 0,
};Explanation
Derived flags simplify call sites and reduce repeated UI conditionals.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Data Fetching Patterns