-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed
Labels
Description
What version of React Router are you using?
6.5.0-pre.1
Steps to Reproduce
Reproduction demo: https://stackblitz.com/edit/github-kmv8on-hr7pvh?file=src/App.tsx
Attempt 1, path becomes /food/snacks/fruit/apple?/apples (with the ?) and wrong page is shown
<Link
to={generatePath('food/:foodName/fruit/:fruitName?/apples', {
foodName: 'snacks',
fruitName: 'apple',
})}
>
Apples (generatePath)
</Link>Attempt 2, throws error Missing ":fruitName" param
<Link
to={generatePath('food/:foodName/fruit/:fruitName?/apples', {
foodName: 'snacks',
'fruitName?': 'apple',
})}
>
Apples (generatePath)
</Link>Expected Behavior
Should had returned /food/snacks/fruit/apple/apples
Actual Behavior
Returns /food/snacks/fruit/apple?/apples
brophdawg11, arnassavickas and boringcactus