ReactJsCode Splitting

Code splitting breaks your application into smaller bundles that can be loaded on demand. This improves initial load times.

import React, { lazy, Suspense } from 'react';

const OtherComponent = lazy(() => import('./OtherComponent'));

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