Skip to content

Instantly share code, notes, and snippets.

@QuynhVir
Created March 19, 2024 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save QuynhVir/ad4f6da5fe33d60b14a417753dd81602 to your computer and use it in GitHub Desktop.
Save QuynhVir/ad4f6da5fe33d60b14a417753dd81602 to your computer and use it in GitHub Desktop.
Delaying React Lazy Loaded Component Import
const IndexPage = React.lazy(() =>
new Promise<{ default: React.ComponentType }>(resolve =>
setTimeout(() => {
resolve(
import('./pages/IndexPage').then(module => ({ default: module.IndexPage }))
);
}, 3000000)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment