How to Abstract Routers using Classes
I'm trying to create a library that leverages a subset of routing functions under the hood. With the release of TanStack Router for SolidJS, I do not want to couple the library specifically to Solid Router and want to provide a
The same pattern above is applied for
1. Is the above paradigm a good way of going about providing the abstraction over routing? If not, what's another way that allows users to configure routing.
2. Every time I use the class, I am getting an exception at the point of the
Not sure how to debug the error. I suppose it has something to do with invoking
Router abstraction that consumers of the library can configure with their router of choice. The way I'm going about that is providing abstract Router classes. Below is one example:The same pattern above is applied for
TanStackRouter as I dynamically load the library in the constructor and implement the same interfaces with all the things that TanStack Router expects. I have two primary questions:1. Is the above paradigm a good way of going about providing the abstraction over routing? If not, what's another way that allows users to configure routing.
2. Every time I use the class, I am getting an exception at the point of the
navigate interface being called despite it being invoked while being a descendant of a <Router /> component in the JSX tree:Not sure how to debug the error. I suppose it has something to do with invoking
const _navigate = this.router.useNavigate(); in the context of a class and not a component? 