| description | Use when wiring shadcn components into a Next.js App Router project, when deciding whether a given shadcn primitive needs a `"use client"` directive, when seeing the "Error: useState is not a function" or "Cannot read properties of null (reading useContext)" hydration errors from a Radix primitive in a server component, when designing the server-shell-plus-client-island layout for a page, when wrapping a context-providing library (next-themes, TanStack Query, jotai, zustand) for the App Router, or when the `rsc` field in `components.json` is set but the generated component file is still missing the directive. Prevents the over-clientification anti-pattern of marking the whole layout `"use client"` (defeats the streaming + RSC bundle savings of App Router), the missing-directive crash where a Radix-state component (Dialog, Select, Sidebar) renders on the server and throws `useState is not a function`, the forgotten Provider wrapper where next-themes ThemeProvider is imported directly into a server layout and crashes on hydration, the boundary-violation pattern where a server component tries to pass `onClick` or a class instance into a client child, and the unstable-directive anti-pattern of trying to apply `"use client"` conditionally or inline. Covers the per-primitive RSC compatibility matrix for the full evergreen-2026 component set (Card, Button, Badge, Alert, Skeleton, Separator, Label, Avatar, AspectRatio, Table, Typography are RSC-safe ; Dialog, Sheet, Drawer, Popover, Tooltip, HoverCard, Select, Combobox, Command, Form, Sonner, Tabs, Accordion, Carousel, Sidebar, Calendar, Toggle, Switch, Slider, Checkbox, Radio Group, Collapsible, ContextMenu, DropdownMenu, Menubar, NavigationMenu, ScrollArea require `"use client"`), the meaning and exact behaviour of `components.json` `rsc: true`, the file-level placement rule for the `"use client"` directive, the hybrid server-shell-plus-client-island composition pattern, the Provider-wrapper pattern (one-line `"use client"` wrapper around next-themes, TanStack Query, jotai), the rule that server components may pass a client component as `children` but not as an event-handler prop, and the serialisation requirement for any data crossing the boundary. Keywords: use client, "use client" directive, react server components, rsc, app router, Next.js server component, Next.js App Router, rsc:true components.json, where to put use client, server component cannot use hooks, server component hydration error, hydration mismatch, client boundary, RSC boundary, RSC compatibility, server component vs client component, server-component-cannot-pass-onclick, can I use Dialog in a server component, can I use shadcn Card in a server component, is Button server safe, ThemeProvider use client, next-themes use client, TanStack Query Provider use client, Sidebar server side, Form server side, Sonner Toaster server side, shadcn rsc flag, shadcn next.js, blank screen, app crashes on hydration, hydration error shadcn, useState is not a function, why is my dialog not opening on the server.
|