unstable_rootParams in 2026: Accessing Layout Params Deep in the Tree Without Prop Drilling
This article was written with the assistance of AI, under human supervision and review.
The next/root-params module, introduced in Next.js 16.3, lets any Server Component in your application read dynamic segments that sit at or above the root layout, without receiving those values as props. For teams building internationalized apps, this means a deeply nested <PriceFormatter> or <DateDisplay> component can call await locale() directly, the same way it would call await cookies(), with no intermediate component forced to accept and forward a value it does not otherwise use.
A root layout holds locale, but a deeply nested component cannot reach it without prop drilling through every intermediate layer
Before next/root-params, the only way to give that <DateDisplay> component the locale value was to thread it down through every layout and component that sat between the root and the leaf. For large apps this created a category of components that existed purely to relay a value, inflating prop signatures and making refactors painful.
A root layout exposes locale through next/root-params and any Server Component reads it directly without intermediate prop passing
next/root-params (stable as of Next.js 16.3) exposes dynamic segments above the root layout as async getter functions importable in any Server Component.unstable_rootParams() was removed in Next.js 16. If your codebase still uses it, the params prop.unstable_cache, or Route Handlers (Route Handler support is planned). layout.tsx sits above [locale] rather than inside it, the locale segment is never registered as a root parameter.
A root parameter is any dynamic segment whose folder sits at or above the file that Next.js treats as the root layout. The root layout is the topmost layout.tsx in the app directory that applies to a given route. Segments defined below that file, further down in the route tree, are ordinary route parameters and remain accessible only through the params prop on the page or layout that defines them.
Consider a structure with app/[locale]/layout.tsx as the root layout and app/[locale]/blog/[slug]/page.tsx as a leaf page. Here locale is a root parameter because it appears in the path before the root layout file. slug is a regular route parameter because it appears below the root layout. The Next.js docs describe this boundary precisely: "Root parameters are the route parameters from dynamic segments that appear in the path up to the root layout file. Other route parameters deeper in the route tree are accessed through the params prop."
A directory tree showing locale above the root layout as a root parameter and slug below it as a regular route parameter
One constraint worth remembering: root parameter names must be valid JavaScript function identifiers. A segment named [post-slug] will cause an error at dev time or during build because kebab-cased names cannot be exported as function names. Rename the folder to [postSlug] or use a simple single-word name to stay clear of this.
When a request arrives, Next.js identifies which root layout applies to the route and reads every dynamic segment in the path up to that layout. Those values are written into an AsyncLocalStorage store that is scoped to the current request. Every async Server Component render that happens within that request's execution context can read from the same store by calling the getter function imported from next/root-params.
A request triggers root layout resolution, writes params into AsyncLocalStorage, and any Server Component in the render tree reads from that store
This is why the getters are async functions that return Promise<string> rather than synchronous accessors. The value is not a module-level global; it is a per-request slot that Next.js populates and that React's server rendering pipeline passes through the async execution context. Calling await locale() inside a Server Component suspends until the slot is populated, which in practice is immediate because the root layout has already run before any child component renders.
This mechanism also explains the caching behavior. Because the getter is an imported function, Next.js can statically analyze which root parameters a "use cache" block depends on and include only those parameters in the cache key. With the old params prop approach you had to await params outside the cached function and pass the resolved value in as an argument, making the dependency explicit but verbose. The official docs note this directly in the caching section. For more on how Next.js 16 rethought caching, see Next.js 15 Caching Changes.
Diagram showing AsyncLocalStorage scoped to a single request lifecycle
The setup requires nothing beyond the correct directory structure. No configuration changes, no additional packages. The getter names are generated automatically from your dynamic segment folder names during next dev, next build, or next typegen, the same process that generates PageProps and LayoutProps types.
For an app/[locale]/layout.tsx root layout, the generated getter is named locale and is importable from next/root-params:
// app/[locale]/layout.tsx
import type { ReactNode } from "react"
interface RootLayoutProps {
children: ReactNode
}
export default async function RootLayout({ children }: RootLayoutProps) {
// The locale value is available via the getter, but the layout itself
// can also receive it through the params prop as usual.
return (
<html>
<body>{children}</body>
</html>
)
}
Any Server Component anywhere in the tree under this layout can now read the locale without receiving it as a prop:
// components/DateDisplay.tsx
// No props needed for locale — the getter provides it directly.
import { locale } from "next/root-params"
interface DateDisplayProps {
date: Date
}
export async function DateDisplay({ date }: DateDisplayProps) {
const currentLocale = await locale()
return (
<time dateTime={date.toISOString()}>
{new Intl.DateTimeFormat(currentLocale, {
year: "numeric",
month: "long",
day: "numeric",
}).format(date)}
</time>
)
}
// app/[locale]/blog/[slug]/page.tsx
// slug is a regular route parameter — it stays on the params prop.
// locale is a root parameter — it comes from the getter in DateDisplay.
import { DateDisplay } from "@/components/DateDisplay"
interface BlogPageProps {
params: Promise<{ slug: string }>
}
export default async function BlogPage({ params }: BlogPageProps) {
const { slug } = await params
// Fetch post data using slug...
const post = await fetchPost(slug)
return (
<article>
<h1>{post.title}</h1>
<DateDisplay date={post.publishedAt} />
<div>{post.content}</div>
</article>
)
}
The BlogPage does not touch locale at all. It passes date to DateDisplay, and DateDisplay resolves the locale independently. This is the core benefit: components that need locale for formatting or translation can be dropped anywhere in the tree without changing the props of every component above them. For a deeper look at how layouts and templates interact in the App Router, see Next.js App Router Layouts and Templates.
useParams
Choosing between these three patterns is straightforward once the constraints of each are clear.
| Approach | Works in Client Components | Requires prop threading | Available in shared utilities | Covers non-root segments |
|---|---|---|---|---|
next/root-params getter |
No | No | Yes | No |
params prop |
Yes (after serialization) | Yes | No | Yes |
useParams() |
Yes | No | No | Yes |
A decision tree branching on whether the component is a Client Component and whether the segment is a root parameter
useParams() from next/navigation is the right tool when a Client Component needs any URL parameter, root or not. It reads from the router context and is synchronous. The tradeoff is that it only works inside a Client Component boundary, so shared server-side utilities cannot use it.
The params prop remains the correct choice for non-root segments like slug, id, or any other dynamic segment below the root layout. It is explicit, type-safe with generated PageProps types, and works across pages, layouts, and metadata functions. The Next.js 16 upgrade guide confirms that all params access is now async: await params before destructuring.
next/root-params getters are the right choice specifically when a Server Component or server-side utility needs a root-level segment and you want to avoid prop threading. The API cannot substitute for the params prop on segments below the root layout, and it cannot cross into Client Components. Those are hard boundaries, not gaps that will be filled in a future release.
One historical note: unstable_rootParams() was an earlier function-based API that the Next.js team shipped during development. It was removed in Next.js 16, before the module-based next/root-params was introduced in 16.3. The upgrade guide lists it in the removals table with next/root-params as the replacement.
The most common mistake is placing the root layout.tsx above the [locale] folder instead of inside it.
A flow showing that locale must be part of the root layout path or the getter returns undefined
If app/layout.tsx exists as the root layout and app/[locale]/ is a nested route group below it, then locale is not a root parameter. The getter import still compiles, but await locale() returns undefined because the segment does not appear in the path up to the root layout. The fix is to move the root layout file to app/[locale]/layout.tsx so that the dynamic segment is part of the root layout's own path.
A second pitfall involves unstable_cache. Calling any root parameter getter inside an unstable_cache callback throws a runtime error. The official docs state this explicitly: "Calling a root parameter getter inside unstable_cache will throw a runtime error. Use 'use cache' instead." The "use cache" directive is the correct pairing because Next.js can track root parameter dependencies within it and incorporate them into the cache key automatically.
Server Actions are another hard boundary. Root parameter getters cannot be called inside a Server Action. If a Server Action needs the locale value, the caller must pass it explicitly as an argument. The same applies to Route Handlers, though the docs note that Route Handler support is planned for a future release.
Common directory structure mistakes that prevent locale from becoming a root parameter
For apps with multiple root layouts, root parameter getters account for routes where a given parameter may not exist. If app/dashboard/[id]/layout.tsx is one root layout and app/marketing/layout.tsx is another, the generated type for id is string | undefined. Calling await id() from a marketing route returns undefined. Code that consumes the getter should guard against this case. The docs describe this under "Multiple root layouts." For background on how the App Router handles multiple layout boundaries and prefetching, see Next.js Link Prefetch and Partial Router Cache.
Catch-all and optional catch-all segments work correctly with next/root-params. A segment defined as [...path] returns string[], and [[...path]] returns string[] | undefined. These return types are reflected in the generated types from next typegen.
The unstable_rootParams() function was removed in Next.js 16. The replacement is the next/root-params module, introduced in Next.js 16.3, which exports individual async getter functions named after each dynamic segment in the root layout path.
No. Root parameter getters only work in Server Components. For Client Components, useParams() from next/navigation reads any URL parameter, including root-level ones, synchronously from the router context.
await locale() return undefined even though the folder exists?
The most common cause is that the root layout.tsx file sits above the [locale] folder rather than inside it. The segment must appear in the file path up to and including the root layout file to be registered as a root parameter.
"use cache" blocks?
Yes, and this is one of their advantages. Next.js tracks which root parameter getters a cached function calls and includes only those values in the cache key. The equivalent with the params prop requires awaiting outside the cached block and passing the resolved value as an argument.
Yes. Root parameter names must be valid JavaScript function identifiers. Kebab-cased segment names like [post-slug] are not supported and will produce an error at dev time or during build. Rename the segment folder to something like [postSlug] or a plain single-word name.
next/root-params solves one specific problem well: it eliminates prop threading for dynamic URL segments that apply to an entire subtree and that subtree is defined by the root layout boundary. The canonical case is a [locale] segment in a fully internationalized app. Any Server Component that needs the locale for formatting, translation key lookup, or server-side API calls can import the getter and await it directly, without any component in between needing to know about it.
Avoid the API when any of these conditions apply: the consuming code runs in a Client Component, runs inside a Server Action, or needs a segment that sits below the root layout. In those cases the params prop or useParams() are the correct tools, and reaching for next/root-params will either fail at build time or return undefined at runtime.
The clearest signal that this API is appropriate is when you find yourself tracing a prop named locale, lang, or a similar global value through three or more layers of components that do nothing with the value except forward it. That is precisely the pattern next/root-params was designed to remove, and removing it makes each component's prop interface reflect only the data that component actually uses.