Why is my context.router undefined in my react component?
The best way to keep up with changes is to look through the Releases page.
In React Router versions that are > 1.0.0-beta3
and < 2.0.0-rc2
, there is no context.router
. Instead, you need to look for context.history
.
If you use versions <= 1.0.0-beta3
or >= 2.0.0-rc2
, the context.router
is there. In short, what happened is it was removed in favor of history
but then the maintainters decided it’s best to hide the History library API behind the router, so they brough back the router
context in 2.0 RC2 and onward.