props version of `navigate` do not support `number` in `to` param
raplemie opened this issue · comments
Issue
I tried to use the route props version of the navigate
function as suggested in the documentation and it crashes when used with a -1
value (or any number).
https://reach.tech/router/api/navigate
Or better, yet, use
props.navigate
passed to your route components and then you can navigate to relative paths...
Code Sandbox
- Boil down your issue on codesandbox (https://codesandbox.io/s/lplnp60wnm).
Changed react and @reach/router dependencies, not sure what default 0.0.0-rc2 is, but it was not supporting the useNavigate
for comparison.
The "Home" route is using the useNavigate
hook to get the navigate
function, which works well.
The "Dashboard" route is using the navigate
from recieved props and cause a crash in the resolve
as it expects a string.
https://codesandbox.io/s/reach-router-starter-v1-forked-8m4e9?file=/src/index.js