Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wealthfront-data-fetching-blog-post/1af851bf7a7fa7911b3a20ace33af7d8 to your computer and use it in GitHub Desktop.
Save wealthfront-data-fetching-blog-post/1af851bf7a7fa7911b3a20ace33af7d8 to your computer and use it in GitHub Desktop.
function Component() {
const { data, isLoading, isError } = useApiQuery('getUser', [userId]);
function renderContent() {
// can assume data is populated in this function!
}
return (
<AsyncStatus
isLoading={isLoading}
isError={isError}
loadingState={<Spinner />}
>
{renderContent}
</AsyncStatus>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment