Created
September 25, 2019 15:40
-
-
Save sibelius/cc2f9ce9b2b00bdd3acf1ef6203e7278 to your computer and use it in GitHub Desktop.
createQueryRendererSuspense helper to make it easy add ErrorBoundaryWithRetry and Suspense handling
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
export const createQueryRendererSuspense = (Component: React.ComponentType<any>) => { | |
const QueryRendererWrapper = props => { | |
return ( | |
<ErrorBoundaryWithRetry fallback={(error, retry) => <ErrorView error={error} retry={retry} />}> | |
<React.Suspense fallback={<LoadingView />}> | |
<Component {...props} /> | |
</React.Suspense> | |
</ErrorBoundaryWithRetry> | |
); | |
}; | |
return QueryRendererWrapper; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment