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

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

Comments

Projects
None yet
5 participants
@israelidanny

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 from Router doesn't pass via context? to Invalid context `router` of type `object` supplied to `NavBar`, expected `function`. Jul 11, 2015

@israelidanny

This comment has been minimized.

Show comment
Hide comment
@israelidanny

israelidanny Jul 11, 2015

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

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

@taion

This comment has been minimized.

Show comment
Hide comment
@taion

taion Jul 11, 2015

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@israelidanny

israelidanny 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.

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

@fmontes

This comment has been minimized.

Show comment
Hide comment
@fmontes

fmontes Jul 20, 2015

My workaround for this right now:

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

fmontes commented Jul 20, 2015

My workaround for this right now:

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

@chafnan

This comment has been minimized.

Show comment
Hide comment
@chafnan

chafnan Jul 22, 2015

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

chafnan commented Jul 22, 2015

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

@israelidanny

This comment has been minimized.

Show comment
Hide comment
@israelidanny

israelidanny 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.

@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

This comment has been minimized.

Show comment
Hide comment
@israelidanny

israelidanny Aug 25, 2015

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

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

@ameensol

This comment has been minimized.

Show comment
Hide comment
@ameensol

ameensol Aug 31, 2015

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

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

@taion

This comment has been minimized.

Show comment
Hide comment
@taion

taion Sep 14, 2015

Member

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

Member

taion commented Sep 14, 2015

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

@taion taion closed this Sep 14, 2015

@geekplux geekplux referenced this issue in ReactTraining/react-router Feb 3, 2016

Closed

Add instruction for how to get context of router #3024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment