Created
July 30, 2024 21:43
-
-
Save wealthfront-data-fetching-blog-post/0bf0feb2e451533cd2c86a0932c6e1ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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