Unverified Commit e694c08b authored by Marcos Hernanz's avatar Marcos Hernanz Committed by GitHub

docs: fix parallelRouteKey parameter name in useSelectedLayoutSegment(s) (#97710)

The `useSelectedLayoutSegment` and `useSelectedLayoutSegments` hooks
accept a
parameter named `parallelRouteKey` (singular), as declared in
`packages/next/src/client/components/navigation.ts`:

export function useSelectedLayoutSegment(parallelRouteKey: string =
'children')

The docs wrote it as `parallelRoutesKey` (plural) in three files, which
doesn't
match the generated `navigation.d.ts` type that editors surface via
IntelliSense:

- `use-selected-layout-segment.mdx` — parameter signature and
description
- `use-selected-layout-segments.mdx` — parameter signature and
description
- `parallel-routes.mdx` — "With useSelectedLayoutSegment(s)" section

Docs-only change; no behavior change.

---

Credit: This contribution was originally authored by @see-stack in
#97690 and is recreated here with signed commits.
Co-authored-by: 's avatarSaid Nasser <sdnssr001@gmail.com>
parent 49bfb650
......@@ -108,7 +108,7 @@ By default, Next.js keeps track of the active _state_ (or subpage) for each slot
### With `useSelectedLayoutSegment(s)`
Both [`useSelectedLayoutSegment`](/docs/app/api-reference/functions/use-selected-layout-segment) and [`useSelectedLayoutSegments`](/docs/app/api-reference/functions/use-selected-layout-segments) accept a `parallelRoutesKey` parameter, which allows you to read the active route segment within a slot.
Both [`useSelectedLayoutSegment`](/docs/app/api-reference/functions/use-selected-layout-segment) and [`useSelectedLayoutSegments`](/docs/app/api-reference/functions/use-selected-layout-segments) accept a `parallelRouteKey` parameter, which allows you to read the active route segment within a slot.
```tsx filename="app/layout.tsx" switcher
'use client'
......
......@@ -40,10 +40,10 @@ export default function ExampleClientComponent() {
## Parameters
```tsx
const segment = useSelectedLayoutSegment(parallelRoutesKey?: string)
const segment = useSelectedLayoutSegment(parallelRouteKey?: string)
```
`useSelectedLayoutSegment` _optionally_ accepts a [`parallelRoutesKey`](/docs/app/api-reference/file-conventions/parallel-routes#with-useselectedlayoutsegments), which allows you to read the active route segment within that slot.
`useSelectedLayoutSegment` _optionally_ accepts a [`parallelRouteKey`](/docs/app/api-reference/file-conventions/parallel-routes#with-useselectedlayoutsegments), which allows you to read the active route segment within that slot.
## Returns
......
......@@ -52,10 +52,10 @@ export default function ExampleClientComponent() {
## Parameters
```tsx
const segments = useSelectedLayoutSegments(parallelRoutesKey?: string)
const segments = useSelectedLayoutSegments(parallelRouteKey?: string)
```
`useSelectedLayoutSegments` _optionally_ accepts a [`parallelRoutesKey`](/docs/app/api-reference/file-conventions/parallel-routes#with-useselectedlayoutsegments), which allows you to read the active route segment within that slot.
`useSelectedLayoutSegments` _optionally_ accepts a [`parallelRouteKey`](/docs/app/api-reference/file-conventions/parallel-routes#with-useselectedlayoutsegments), which allows you to read the active route segment within that slot.
## Returns
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment