Skip to content

[Feature]: Have ability to read route id from the nearest route context #9543

@hasan-wajahat

Description

@hasan-wajahat

What is the new or updated feature that you are suggesting?

Just like we can use useLoaderData hook to get loader data from nearest route context, it can be useful to get id of the nearest route context.
Keep in mind useMatches hook matches for all routes not the nearest route context so that won't be of any help here.

Why should this feature be included?

For me personally I need it because I want to depend upon the auto-generated id to get nesting depth of a specific element and I can't come up with any cleaner way. But it may be useful for other people to have access to id for their own reasons.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestUsed to close PRs that haven't gone through/been accepted the Proposal process yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions