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

PySpark - Working with JDBC Sqlite database