-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
useHref error with react router v7 #147
Comments
I've the exact same issue - after migrating from remix 2 to rr7 my app is crashing with the following error: useHref() may be used only in the context of a component. I'm using the following versions:
|
It seems that this is an upstream issue in React Router - remix-run/react-router#12475. I've managed to fix it for myself in the time being by removing all the You could use something like patch-package for now to remove them until React Router push a fix. Although, as I'm writing this I just saw they've merged a fix (remix-run/react-router#12729) and it's available in EDIT: React Router |
@sheepsteak: thanks for your feedback! I can confirm using the react router pre-release (7.1.2-pre.0) seems to have fixed the issue. |
This indeed is an issue with react-router that they have been working on for a few weeks now, if it wasn't for useHref it would complain about useSubmit as it doesn't properly de-dupe dependencies. |
Thanks a lot for the explanation. |
I am currently migrating an app from remix 2 to react router v7.
I have, unfortunately only sometimes, at least in dev mode, .... I get the error:
useHref() may be used only in the context of a component.
Using
The following route / component:
throws the error in useRemixForm not the line above.
The text was updated successfully, but these errors were encountered: