State Management · Senior · Question 7 of 75
Why are Context providers in the Next.js App Router placed in a separate client component?
- ✓Correct answer:
createContextis a client-only API; the server layout renders<Providers>{children}</Providers> - 2Server components render providers twice
- 3Providers must be loaded lazily to avoid SSR
Explanation
A 'use client' providers.tsx wraps children, which stay server components because they're passed as props. Place providers as deep as possible so more of the tree remains static.