-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Closed
Labels
Description
What version of React Router are you using?
6.12.1
Steps to Reproduce
generatePath('/product/:id', { id: 0 })
returns /products
(expected: /products/0
)
I know it's kinda not valid to pass 0 as a number, BUT it worked in 6.3.0 and before (so it's a regression). Also passing any other number works ok:
generatePath('/product/:id', { id: 1 })
returns /products/1
generatePath('/product/:id', { id: 2 })
returns /products/2
of course, passing 0 as string works as well
generatePath('/product/:id', { id: '0' })
returns /products/0
The fact that it works for other numbers could cause issues, because developers might use it, and then suddenly when the value is 0 it stops to work.
Expected Behavior
generatePath('/product/:id', { id: 0 })
-> /products/0
Actual Behavior
generatePath('/product/:id', { id: 0 })
-> /products