Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 57x 14x 14x 1x 1x | import { lazy, Suspense } from 'react'
export function LazyLoader({
factory,
}: {
factory: () => Promise<{ default: React.ComponentType<unknown> }>
}) {
const Component = lazy(factory)
return (
<Suspense
fallback={
<div className="flex min-h-screen items-center justify-center">
<p className="text-muted-foreground">Loading...</p>
</div>
}
>
<Component />
</Suspense>
)
}
|