01 / Foundation
Understand the concept
Lazy loading reduces the initial JavaScript bundle by loading components only when they are required.
Combined with React Suspense, lazy loading improves page load times and creates a smoother user experience.
02 / Implementation
React.lazy Example
lazy-loading.tsx
import { lazy, Suspense } from "react";
const Dashboard = lazy(() => import("./Dashboard"));
export default function App() {
return (
<Suspense fallback={<p>Loading...</p>}>
<Dashboard />
</Suspense>
);
}04 / Interview