Code splitting with React - suspense



React supports code splitting by default now using Suspense as shown in the following code snippet.
Awesome stuff



import React, {lazy, Suspense} from 'react';
const OtherComponent = lazy(() => import('./OtherComponent'));

function MyComponent() {
return (
<Suspense fallback={
Loading...</div>}>
<OtherComponent />
</Suspense>
);
}




 

Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm