Created
December 20, 2021 01:45
-
-
Save thisizkp/52b90f3d7b1f3f01a2540153c1083717 to your computer and use it in GitHub Desktop.
Container component in React v18
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
import { Suspense, ErrorBoundary } from 'react' | |
export function Container({ Loader, Error, children }) { | |
return ( | |
<Suspense fallback={<Loader/>}> | |
<ErrorBoundary FallbackComponent={<Error/>}> | |
{children} | |
</ErrorBoundary> | |
</Suspense> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment