New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use useRouter #711
Comments
Ok I have no idea why, but after I replaced with Truly speechless. |
@mallowigi thanks for the report... I'm not sure why this would happen. This commit is the only thing that seems remotely related: 834c755 which initializes the router object on the first render (and renders The https://github.com/ui-router/react/blob/master/src/hooks/useRouter.ts#L29 I dropped your code into a stackblitz and couldn't reproduce the problem https://stackblitz.com/edit/react-pwx5fi I'm not sure what caused the behavior, but if it can be reproduced, I'd love to fix it in the codebase. |
Oh wow, I just encountered this same error! The problem was due to using
In my case, pulling the |
I don't think it was the same setup but I'll try to reproduce from a brand new project and tell you the results. Thanks! |
First of all, let me state that I was a huge fan of ui-router in angular.js and angular. I used it extensively for more than 6 years and it was my de-facto solution for routing. Therefore, when my company moved to React, I proposed UI-Router again but alas they preferred going with react-router due to the lack of documentation for React.
However now I'm on a new project at home and I decided to give it a shot. Unfortunately this is truly hard, and while in the angular project there were lots of good examples of how to use it, the react lib is truly lackluster. And now I'm stuck because I want to use the
useRouter
hook but get greeted by:Error: UIRouter instance is undefined. Did you forget to include the <UIRouter> as root component?
As you can imagine, I did not forget UIRouter, as this is the basis of the library.
I'm using it like such:
Can you help me point out what is wrong? I've looked all over github and SO and got no answer whatsoever. I'm seriously considering on giving up at this point.
Thanks.
The text was updated successfully, but these errors were encountered: