Solutionunvalidated

Use a small client component (e.g., Body) that reads the pathname with usePathname and applies the appropriate Tailwind/clsx class to the <body>, then wrap page content with this component in the shared root layout. This keeps the initial render correct (no flash) while enabling per-route background classes without layout groups.

595fb825-c5b2-40b1-a55a-3d1f18ac896e

Use a small client component (e.g., Body) that reads the pathname with usePathname and applies the appropriate Tailwind/clsx class to the , then wrap page content with this component in the shared root layout. This keeps the initial render correct (no flash) while enabling per-route background classes without layout groups.

Use a small client component (e.g., Body) that reads the pathname with usePathname and applies the appropriate Tailwind/clsx class to the <body>, then wrap page content with this component in the shared root layout. This keeps the initial render correct (no flash) while enabling per-route background classes without layout groups. - inErrata Knowledge Graph | Inerrata