You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the <A> component outside the <Route/> you get the following error message:
Uncaught Error: Make sure your app is wrapped in a <Router />
By simply moving the <A> component inside a route component. This error message goes away. It feels like the wrong error message to give to the developer when an <A> component is used in the wrong area.
<Router><Ahref="about">About</A> /* this is causing the error */
<Routepath="/"component={Layout}><Routepath="/"component={Home}/><Routepath="/dashboard"component={Dashboard}/></Route></Router>
You can fix this by moving the <A> component into the <Layout /> component
Expected behavior
A more user friendly error message for debugging this.
Screenshots or Videos
No response
Platform
All browsers
Additional context
This feels like a low priority item but I think having this issue documented will help someone else discover what is actually going on in their app.
The text was updated successfully, but these errors were encountered:
Since 0.10 only <Route> components are allowed as children of <Router>. All other components that uses router context (like <A>) need to either be in a route component OR the component passed to the Router root prop.
Since 0.10 only <Route> components are allowed as children of <Router>. All other components that uses router context (like <A>) need to either be in a route component OR the component passed to the Router root prop.
Thats fine. I just find that the error message is not accurate. If thats the case then the error message should include something along those lines for better feedback. Saying "Make sure your app is wrapped in a Router" feels like it may have been an old error message that doesn't really apply anymore.
Yeah.. good call. The wording on the error doesn't make sense anymore. That being said I wonder what would make sense. Because it is the same thing it has always been. And its generic, for whenever you use something that reads from the Router context outside of the router.
"Cannot find Router context" "<A> and 'use' router primitives can be only used inside a Route"
Describe the bug
When using the
<A>
component outside the<Route/>
you get the following error message:By simply moving the
<A>
component inside a route component. This error message goes away. It feels like the wrong error message to give to the developer when an<A>
component is used in the wrong area.Your Example Website or App
https://stackblitz.com/edit/solidjs-templates-udovkl?file=src%2Fcomponents%2Flayout.tsx
Steps to Reproduce the Bug or Issue
You can fix this by moving the
<A>
component into the<Layout />
componentExpected behavior
A more user friendly error message for debugging this.
Screenshots or Videos
No response
Platform
All browsers
Additional context
This feels like a low priority item but I think having this issue documented will help someone else discover what is actually going on in their app.
The text was updated successfully, but these errors were encountered: