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

Outlet doesn't work in "react-router-dom": "^6.0.0-beta.2" #8166

Closed
BerkayAkgurgen opened this issue Oct 25, 2021 · 1 comment
Closed

Outlet doesn't work in "react-router-dom": "^6.0.0-beta.2" #8166

BerkayAkgurgen opened this issue Oct 25, 2021 · 1 comment

Comments

@BerkayAkgurgen
Copy link

BerkayAkgurgen commented Oct 25, 2021

// PrivateRoute.js
import useAuth from "hooks/useAuth";
import { Outlet, Navigate } from "react-router-dom";

const PrivateRoute = () => {
  const auth = useAuth();

  return auth ? <Outlet /> : <Navigate to="/page-not-found" />;
};
// Routes.js
<Route path="/dashboard" element={<PrivateRoute />}>
          <WithLayoutDashboard component={Account} layout={AppLayout} />
</Route>

This code doesn't render my outlet component. How can I fix it? And why did happen?

@timdorr
Copy link
Member

timdorr commented Oct 25, 2021

#8111 (comment)

and

#8092 (comment)

@timdorr timdorr closed this as completed Oct 25, 2021
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