Skip to content

[Bug]: useParams type has changed from string to string | undefined #8056

@tim-field

Description

@tim-field

What version of React Router are you using?

v6

Steps to Reproduce

If I have a route /:id

Expected Behavior

Its not possible for the component assigned to render with id as undefined

Actual Behavior

But since this PR was merged, id is typed as string | undefined

#8019 (comment)

This is breaking a fair few things for us, and AFAIK its not possible to have optional parameters in V6 so the undefined type here isn't correct ?

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