Nâng CaoReact iconReact

Code splitting trong React thực hiện thế nào? Lazy loading routes?

Code splitting tách bundle thành nhiều chunks nhỏ, chỉ load khi cần — giảm đáng kể initial bundle size.

jsx
const HeavyComponent = React.lazy(() => import('./HeavyComponent'));
// Bọc trong Suspense:
<Suspense fallback={<Loading />}>
  <HeavyComponent />
</Suspense>

Cho routes: lazy load từng page component.

Webpack/Vite tự động tách chunk tại dynamic import boundaries.

Xem toàn bộ React cùng filter theo level & chủ đề con.

Mở danh sách React