useRouter hook
I'm trying to use the useRouter hook so that I can acquire the base path and pass it into my sidebar component without the end user having to write it themselves. Also, I'd like to acquire all defined routes so that I can match against whatever route was defined in my component, and tell the end user the route defined doesn't exist. But correct me if I'm wrong, is the useRouter hook private?
Upon analyzing the router/index.jsx distribution, I think it is private, right? So that's why I'm getting the previous error.
Could we discuss a PR to expose the useRouter hook, or perhaps a new hook exposing read-only access to this information?
The component im building for better context:
4 Replies
useRouter
isn't exposed yet as the router api isn't stable yet
i think there's an issue open about it
For a 404 page i'd recomend using a catchall routeah ok, found it
https://github.com/solidjs/solid-router/pull/413
GitHub
Re-Export RouterContext for more control by iamcsharper · Pull Requ...
The problem
I develop a PWA mobile-first application based on solid start.
I liked the prefetch behaviour while debugging the app in my laptop environment, so when you hover any link, the resources...
I don't think so. In this particular case, I want the developer to know if the route they defined in the sidenav doesn't exist in the actual router, before it ever makes it to production.
Ah yeah i'm not sure that'd be possible yet