Router: Redirect is not working correctly, are there any points I missed?

Created on 7 Jun 2018  路  9Comments  路  Source: reach/router

I tried to Redirect from root to a path, but it failed with:
Error
[object Object]
https://codesandbox.io/s/qllp20v3j4

Did I use the Redirect incorrectly?

bug

Most helpful comment

@ryanflorence Can we reopen this issue? I have the same problem.

All 9 comments

You are using it correctly, it is just the regular behavior of the Redirect component to throw when redirecting (as explained in the documentation here https://reach.tech/router/api/Redirect).
So to get rid of the exception in development mode, you can add the noThrow prop to the Redirect

@AlanChauchet thanks for you comment. I had read the api document several times and tried to use the noThrow prop as you said. the URL changed, but the to component is not render on page before refresh.

@LeoChowChina looks like we are having the same issue https://github.com/reach/router/issues/47

i have the same issue. the URL changes but it doesn't trigger routing. don't know what I missed

@shenAwesome @AlanChauchet I think it's a bug. Hope It will be fixed by @ryanflorence soon...

Looks like noThrow is busted

Oh right, Redirect mounts before LocationProvider, gonna throw a hack in to fix this, might not be the best way to do it, but it'll work.

@ryanflorence Can we reopen this issue? I have the same problem.

Still problem here

Was this page helpful?
0 / 5 - 0 ratings

Related issues

florian-bd picture florian-bd  路  3Comments

micabe picture micabe  路  4Comments

EJIqpEP picture EJIqpEP  路  4Comments

jsonmaur picture jsonmaur  路  4Comments

ricardobrandao picture ricardobrandao  路  5Comments