-
Notifications
You must be signed in to change notification settings - Fork 320
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
react-router
v7 compatibility
#4641
Comments
We are working on a new sdk specific for react router |
Just to give an update here, I'm awaiting feedback on an issue I filed at the Remix repository: remix-run/react-router#12399 (there were holidays in America so waiting time is expected). Once that's fixed I'm positive that a Beta release won't take long afterwards. |
Hello folks, since the issue mentioned above was fixed I was able to update the PR. You could give this version a try: npm install @clerk/[email protected] --save-exact Inside your import { rootAuthLoader } from "@clerk/react-router/ssr.server";
import { ClerkProvider, SignedIn, SignedOut, UserButton, SignInButton } from "@clerk/react-router";
export async function loader(args: Route.LoaderArgs) {
return rootAuthLoader(args)
}
export default function App({ loaderData }: Route.ComponentProps) {
return (
<ClerkProvider loaderData={loaderData}>
<Outlet />
</ClerkProvider>
);
} The full docs are being worked on here: clerk/clerk-docs#1760 |
Hey, @LekoArts. I just tried the build you posted and found that it works well for my side project. Once set up, I can't tell the difference from the Remix version. |
@LekoArts Thanks for all your work on this. After following your instructions, I'm getting the error: useNavigate() may be used only in the context of a component. I see remix-run/react-router#12399 and I'm running the latest react-router version (7.0.2). This PR did not fix the issue for me. If I comment out the ClerkProvider, the error goes away. I am attempting to upgrade a Remix v2 + React 19 app to RR7. Is this a known error or am I doing something else wrong? Maybe a conflict because of React 19? UPDATE: This issue was resolved by downgrading Vite back to version ^5. I had been attempting to use the latest, but apparently the temporary fix for useNavigate() does not work on Vite 6 and above. |
@iangrayhazzard Thanks for giving it a try and reporting back what solved your issue. As far as I can tell our library should be doing everything correctly, so I'd encourage you to report these issues to the React Router folks so that they can solve it. |
The announcement (https://clerk.com/changelog/2024-12-12-react-router-beta) and the docs (https://clerk.com/docs/references/react-router/overview) are now live! |
That's amazing @LekoArts you are the best!! Just a suggestion, I'd throw a redirect rather than returning it if the user is not signed in: https://remix.run/docs/ja/main/utils/redirect
if (!session) {
throw redirect("/login", 302);
} |
@ZeldOcarina The React Router docs only show returning it as also mentioned in this issue (remix-run/react-router#12335) so I'd need to ask them what is correct now. Or if either is fine. |
Oh I see.. maybe there's a difference with React Router.. |
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://unfortunately-not-available
Publishable key
pk_test_not_relevant_to_the_question
Description
@clerk/remix
has a peer dependency on@remix-run/react
.A couple of days ago, React Router v7 was released, which is the recommended migration path for Remix apps. However,
@clerk/remix
is not compatible with RR v7 due to the aforementioned peer dependency, and the React Router section of the Clerk docs mention thatSo this is a friendly request to make Clerk compatible with RRv7.
Thanks!
Environment
The text was updated successfully, but these errors were encountered: