Looks very neat, Though I felt uncomfortable with spreading of routes-information through the component tree if I have to look for which routes matches, I need to traverse through the component tree, It will be useful if there is some utility like rails routes.
After about the 4th version of react-router I had had enough. I have been using navigo which is pretty similar to what you have here. I shall try hookrouter. Thanks
Just finishing integrating hookrouter into my current project. I like it a lot so far! Very easy to implement and reason around.
On a certain page my user is filling out a form, and I want to confirm before they can leave, to prevent loss of unsaved data.
I think it would be better if this was baked into the package somehow. I'd want something simple where you could set it for a whole page and it applies to children and parents. I also would prefer to be able to pass any function, in case window.confirm() isn't good enough.
This seems pretty straightforward. I get worried about the complexities of nesting routes, but then I have a fairly simple use-case anyway so I doubt I'll get into the weeds.
Similar to another commenter, it never seemed quite natural to me to define routes in jsx. Your solution looks more like a server-side routing table and I appreciate that!
Looks very neat, Though I felt uncomfortable with spreading of routes-information through the component tree if I have to look for which routes matches, I need to traverse through the component tree, It will be useful if there is some utility like rails routes.
After about the 4th version of react-router I had had enough. I have been using navigo which is pretty similar to what you have here. I shall try hookrouter. Thanks
Author here - comments and feedback is highly welcome! :)
Just finishing integrating hookrouter into my current project. I like it a lot so far! Very easy to implement and reason around.
On a certain page my user is filling out a form, and I want to confirm before they can leave, to prevent loss of unsaved data.
I think it would be better if this was baked into the package somehow. I'd want something simple where you could set it for a whole page and it applies to children and parents. I also would prefer to be able to pass any function, in case window.confirm() isn't good enough.
This seems pretty straightforward. I get worried about the complexities of nesting routes, but then I have a fairly simple use-case anyway so I doubt I'll get into the weeds.
Similar to another commenter, it never seemed quite natural to me to define routes in jsx. Your solution looks more like a server-side routing table and I appreciate that!
Very intelligent approach! JSX for routes always seemed weird.
I especially like the explicit url parameter passing vs. others where it just magically shows up in your component.
Thanks a lot! That also was one of the main issues I had with React Router and Reach Router.
Coming from a web background, this approach makes a lot of sense to me. Thank you, I'll definitely take it for a spin.
I dig the simplicity, i would give it a try with a small project.
I like it! It reminds me of the approach React Native Navigation uses with explicitly declaring things up front.
This looks great! I'm going to try it in my current project.
how it use with hash?
does not work with TS