-
Notifications
You must be signed in to change notification settings - Fork 286
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
Error after following RR7 quick start guide - useNavigate() may be used only in the context of a <Router> component #4826
Comments
I was just migrating one of my repos to rr7 and Happy to provide more information / reproductions if necessary. |
See here: #4641 (comment) Temporarily downgrading Vite from v6 to v5 also worked for me. |
We had the same issue, downgrading Node from 22.12 to 22.11 seemed to resolve. |
I downgraded to node v20.18.1 using nvm and it fixed the issue. |
the repro is using
Thanks, this also worked for the app I am migrating. Had an issue with the minimal repro though - the example given in step 4 of the guide says:
when clicking on the sign in button, it doesn't redirect to the account portal hosted signin page. Instead it gets redirected to: To make it work, had to create the import { SignIn } from '@clerk/react-router';
export default function SignInPage() {
return (
<div
style={{
backgroundImage: 'url(/bg.svg)',
backgroundPosition: 'center',
backgroundSize: 'cover'
}}
className="flex h-screen w-screen items-center justify-center"
>
<SignIn routing="path" path="/signin" />
</div>
);
} and update import { type RouteConfig, index, route } from "@react-router/dev/routes";
export default [
index("routes/home.tsx"),
route("signin", "routes/signin.tsx"),
] satisfies RouteConfig; |
Hi, this is an upstream issue with React Router and is tracked at remix-run/react-router#12475. Most often downgrading the Node.js version helped. Please follow that upstream issue for a resolution. |
Preliminary Checks
I have reviewed the documentation: https://clerk.com/docs
I have searched for existing issues: https://github.com/clerk/javascript/issues
I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://github.com/sanisoclem/clerk-rr7-repro
Publishable key
Description
Starting a new RR7 project and following the clerk guide doesn't produce a working app. The page errors out with:
A few things I have tried:
ClerkProvider
to layout - same outcomeSteps to reproduce:
npx create-react-router@latest my-react-router-app
pnpm add @clerk/react-router
root.tsx
to userootAuthLoader()
root.tsx
's default exportApp
and wrapOutlet
withClerkProvider
Expected behavior:
To be redirected to login page
Actual behavior:
Error is shown:
Environment
The text was updated successfully, but these errors were encountered: