Dev Helpers

Next.js / Layout segments

Nested section title

Dev Helpers · March 20, 2026

A nested layout can supply section context once for all of its children. Keep the page-specific heading under that shared context.

Worked example

"use client";

// components/NestedSectionTitle.tsx

import { useSelectedLayoutSegment } from "next/navigation";

export default function NestedSectionTitle() {
  const segment = useSelectedLayoutSegment();
  return <h2>{(segment ?? "Overview").replaceAll("-", " ")}</h2>;
}

Implementation notes

Layouts persist across eligible navigations. Avoid assuming the parent component remounts every time a child route changes.

Try it yourself

Navigate between sibling pages and inspect the heading outline.

Open the Next.js example →

Editorial date March 20, 2026 · Published December 6, 2026

Related articles

Free bin volume

Free storage volume depends on consistent dimensions and units. Derive capacity and usage in the same unit before formatting a human-readable summary.

Draft preview indexing

Draft pages need deliberate indexing metadata. An indexing directive controls crawler intent, while access to unpublished material needs a separate permission check.

Party size allocation

Allocating a party into groups is an integer problem. The remainder determines whether another group is needed and how full it will be.