Skip to content

Instantly share code, notes, and snippets.

@eyaleizenberg
Last active June 20, 2019 10:41
Show Gist options
  • Save eyaleizenberg/742700d7240a021efdb2a4056dc18b51 to your computer and use it in GitHub Desktop.
Save eyaleizenberg/742700d7240a021efdb2a4056dc18b51 to your computer and use it in GitHub Desktop.
const OtherComponent = React.lazy(() => import('./OtherComponent'));
function MyComponent() {
return (
<div>
<React.Suspense fallback={<div>Loading...</div>}>
<OtherComponent />
</React.Suspense>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment