App Router

acme.com
/context/
Server Component Boundary
Counter Context Provider [Client Component]
Server Component Boundary
Counter Context [Client Component]

Client Context

  • This example uses context to share state between Client Components that cross the Server/Client Component boundary.
  • Use children to both render client and server components.Composition Patterns.
  • Try incrementing the counter and navigating between pages. Note how the counter state is shared across the app even though they are inside different layouts and pages that are Server Components.