Skip to content

Feature Request: routeMeta function #535

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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