Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

navigate does not obey Router basepath #518

Open
MuthuKumarDeveloper opened this issue Feb 24, 2023 · 1 comment
Open

navigate does not obey Router basepath #518

MuthuKumarDeveloper opened this issue Feb 24, 2023 · 1 comment

Comments

@MuthuKumarDeveloper
Copy link

MuthuKumarDeveloper commented Feb 24, 2023

I set a basepath for Router like below

<Location> {({ location }) => ( <PageTransitionGroup> <CSSTransition key={location.key} classNames="fade" timeout={100}> <PageRouterBlock location={location} basepath="/web"> {props.children} </PageRouterBlock> </CSSTransition> </PageTransitionGroup> )} </Location>
and my routers
<FadeTransitionRouter> <ProtectedRoute path="/" default component={Home} /> <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
Copy link

jndietz commented Apr 18, 2023

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 />.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants