pm4ai

React & Next.js

React 19 and Next.js conventions

React 19 + Next.js

  • Server components by default — layout.tsx, loading.tsx, error.tsx are server components
  • 'use client' only when needed — components with hooks must be client components
  • No IIFEs in JSX — extract to a named component instead
  • No raw HTML elements when shadcn has a component — use Button not <button>, Table not <table>, Progress not nested divs
  • use* hook naming enforced
  • Stable array keys — never use indices
  • <Suspense> around useSearchParams()
  • No Date.now() / Math.random() in render

On this page