Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wealthfront-data-fetching-blog-post/0bf0feb2e451533cd2c86a0932c6e1ae to your computer and use it in GitHub Desktop.
Save wealthfront-data-fetching-blog-post/0bf0feb2e451533cd2c86a0932c6e1ae to your computer and use it in GitHub Desktop.
// simplified
export function AsyncStatus({
children,
customErrorState,
isError,
isLoading,
loadingState
}) {
if (isLoading) {
return loadingState;
}
if (isError) {
return customErrorState ?? <Error />;
}
return children();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment