reach / router

https://reach.tech/router
MIT License
6.91k stars 326 forks source link

navigate does not obey Router basepath #518

Open MuthuKumarDeveloper opened 1 year ago

MuthuKumarDeveloper commented 1 year ago

I set a basepath for Router like below

` {({ location }) => (

{props.children}
  )}
</Location>

and my routers

    <ProtectedRoute path="/home" component={HomePage} />
    <PublicRoute path="/login" component={LoginPage} />
  </FadeTransitionRouter>`

I redirect one page to another page using navigate component import { navigate } from "@reach/router"; navigate("/home");

It should redirect to web/home but currently, the Home link breaks(it redirects to /home).

Should I add a base path for all the navigate?

jndietz commented 1 year ago

I'm not sure this answers your question, @MuthuKumarDeveloper , but I've found that with this library, you have to specify the basepath anywhere you need to perform some kind of navigation with either hook or <Link />.