Skip to content

Instantly share code, notes, and snippets.

@thisizkp
Created December 20, 2021 01:45
Show Gist options
  • Save thisizkp/52b90f3d7b1f3f01a2540153c1083717 to your computer and use it in GitHub Desktop.
Save thisizkp/52b90f3d7b1f3f01a2540153c1083717 to your computer and use it in GitHub Desktop.
Container component in React v18
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