Reference these guidelines when Writing new React components, implementing data fetching, or refactoring code.
1. Eliminating Waterfalls (CRITICAL)
- async-defer-await: Move await into branches where actually used
- async-parallel: Use Promise.all() for independent operations
- async-dependencies: Use better-all for partial dependencies
- async-api-routes: Start promises early, await late in API routes
- async-suspense-boundaries: Use Suspense to stream content
2. Bundle Size Optimization (CRITICAL)
- bundle-barrel-imports: Import directly, avoid barrel files (e.g.
import { foo } from 'bar' vs import foo from 'bar/foo')
- bundle-dynamic-imports: Use next/dynamic for heavy components
- bundle-defer-third-party: Load analytics/logging after hydration
- : Load modules only when feature is activated