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

[v6] react routes with absolute paths? #7413

Closed
bluskript opened this issue Jun 13, 2020 · 1 comment
Closed

[v6] react routes with absolute paths? #7413

bluskript opened this issue Jun 13, 2020 · 1 comment

Comments

@bluskript
Copy link

bluskript commented Jun 13, 2020

While using React Router v6, I noticed that it is no longer possible to create non-relative react routes. Here's why I need them:

const Root = React.memo(() => {
    <Routes>
      <Route path="/entry/:page/*" element={<EntryPage />} />
    </Routes>
});
const pages = {"serverselect": 0, "auth": 1};
export const Entry = React.memo(() => {
  const { page } = useParams();
  return (
    <Stepper activeStep={pages[page]}>
    </Stepper>
    <Routes>
      <Route path="/entry/serverselect" element={<ServerSelect />} />
      <Route path="/entry/auth/:mode" element={<AuthPage />} />
    </Routes>
  );
};

As seen here, I need both the page parameter available in Entry (for the stepper), while also being able to use the parameter as part of a route (for rendering the actual steps). However, this does not work as expected. In order for ServerSelect to render, I must go to /entry/*/entry/serverselect instead of /entry/serverselect

@bluskript bluskript changed the title [v6] Non-relative react routes? [v6] Absolute path react routes? Jun 13, 2020
@bluskript bluskript changed the title [v6] Absolute path react routes? [v6] react routes with absolute paths? Jun 13, 2020
@timdorr
Copy link
Member

timdorr commented Jun 13, 2020

Duplicate of #7335

@timdorr timdorr closed this as completed Jun 13, 2020
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