S
SolidJS•5mo ago
derKuba

window.location.search not empty after changing route

I need your help because I'm stuck and not sure how to proceed. I have a Solid.js app with the following sample code: ```jsx import { A, useLocation, useNavigate } from "@solidjs/router"; const Navigation: Component = () => { return ( <> <A href={"/themen"}>REDAKTIONSTHEMEN</A> </> ); }; // Router Configuration import { Route, Router } from "@solidjs/router"; <Router root={Main}> <Route path={ROUTES.root} component={Topics} // load={() => {}} // template /> <Route path={"/themen"} component={Topics} /> </Router> Now, when I'm on this example URL http://example.com?search=lalal&sort=ASC and I click on the mentioned link within the A component, I correctly land on http://example.com/themen, and there are no URL parameters. However, when I call window.location.search in the onMount() block, I still get "search=lalal&sort=ASC". Do you have any idea what might be going wrong?
1 Reply
derKuba
derKuba•5mo ago
just instead of using window.location, use " import { useLocation } from "@solidjs/router";" that will do the trick 🙂