Created
July 30, 2024 21:43
-
-
Save wealthfront-data-fetching-blog-post/fca17be28e5a576c469135aeb4636a55 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function Component() { | |
const { data, isLoading, isError } = useApiQuery('getUser', [userId], { suspense: true }); | |
// can assume data is populated at the top level! | |
return /* ... */ | |
} | |
function Wrapper() { | |
return ( | |
<ErrorBoundary fallback={<Error />}> | |
<Suspense fallback={<Spinner />}> | |
<Component /> | |
</Suspense> | |
</ErrorBoundary> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment