Skip to content

Feature Request: routeMeta functionΒ #535

@knpwrs

Description

@knpwrs

Inspired by Remix's export meta feature: https://remix.run/docs/en/v1/route/meta

Essentially you can export a meta function from route components, and then higher up in the component tree use useMatches to get all of the matching meta functions and use the data.

Two example use cases come to mind:

  1. Breadcrumbs (example on this page). Route component files can return title and href properties from their meta functions. A parent component can get all of these results and render breadcrumbs.
  2. Shared layout titles. Similar to breadcrumbs, basically just getting a title for whatever is being rendered inside of <Outlet /> and rendering it in a consistent way for all child routes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions