Skip to content
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

Invalid context `router` of type `object` supplied to `NavBar`, expected `function`. #91

Closed
israelidanny opened this issue Jul 11, 2015 · 10 comments

Comments

@israelidanny
Copy link

@israelidanny israelidanny commented Jul 11, 2015

Am I missing something. I get this set of warnings all the time:

[1] Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `NavBar`, expected `function`. Check the render method of `App`.
[1] Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `NavItemLink`, expected `function`. Check the render method of `NavBar`.
[1] Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `NavItemLink`, expected `function`. Check the render method of `NavBar`.
[1] Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `NavItemLink`, expected `function`. Check the render method of `NavBar`.
[1] Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `NavBar`, expected `function`. Check the render method of `App`.
[1] Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `NavItemLink`, expected `function`. Check the render method of `NavBar`.
[1] Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `NavItemLink`, expected `function`. Check the render method of `NavBar`.
[1] Warning: Failed Context Types: Invalid context `router` of type `object` supplied to `NavItemLink`, expected `function`. Check the render method of `NavBar`.
@israelidanny israelidanny changed the title Router doesn't pass via context? Invalid context `router` of type `object` supplied to `NavBar`, expected `function`. Jul 11, 2015
@israelidanny
Copy link
Author

@israelidanny israelidanny commented Jul 11, 2015

I double checked, and indeed router is an object. At least with my app and "react-router": "1.0.0-beta3"

@taion
Copy link
Member

@taion taion commented Jul 11, 2015

Looks like an incompatibility with react-router beta then. This is correct for the current release.

@taion taion added this to the React Router v1.0 milestone Jul 11, 2015
@israelidanny
Copy link
Author

@israelidanny israelidanny commented Jul 12, 2015

If you want to open a new branch for react-ruoter v1, I would be more than glad to pull request some fixes.

@fmontes
Copy link

@fmontes fmontes commented Jul 20, 2015

My workaround for this right now:

Component.contextTypes = {
router: function() { return React.PropTypes.func.isRequired; }
};

@chafnan
Copy link

@chafnan chafnan commented Jul 22, 2015

@israelidanny: Are you still working on a fix for this?

@israelidanny
Copy link
Author

@israelidanny israelidanny commented Aug 25, 2015

@chafnan - well, actually - the fix is mega super simple, @fmontes got it right.
But if I push a PR, it will make this incompatible with older versions.

@israelidanny
Copy link
Author

@israelidanny israelidanny commented Aug 25, 2015

I'm gonna push the fix to the new branch.

@ameensol
Copy link

@ameensol ameensol commented Aug 31, 2015

@israelidanny were you able to push the fix to a new branch? I'm running into this issue as well.

@taion
Copy link
Member

@taion taion commented Sep 14, 2015

router isn't even a thing any more on the newest betas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.