Skip to content

[Wiki] React Router 5.x does not provide React Context#1778

Merged
pickypg merged 2 commits intomasterfrom
wiki/correct-react-router-5x
Mar 28, 2019
Merged

[Wiki] React Router 5.x does not provide React Context#1778
pickypg merged 2 commits intomasterfrom
wiki/correct-react-router-5x

Conversation

@pickypg
Copy link
Member

@pickypg pickypg commented Mar 28, 2019

This corrects the previous edit suggesting that react-router 5.0
was completely backward compatible with 4.x.

It turns out, while trying to use this trick to extract the context
within the constructor that this.context.router is undefined.

I assume that we just need to use a context consumer, but I
do not see its name or type documented anywhere.

I also shortened the code examples a tiny bit.

This corrects the previous edit suggesting that `react-router` 5.0
was completely backward compatible with 4.x.

It turns out, while trying to use this trick to extract the `context`
within the constructor that `this.context.router` is `undefined`.

I _assume_ that we just need to use a context consumer, but I
do not see its name or type documented anywhere.
@pickypg pickypg added the documentation Issues or PRs that only affect documentation - will not need changelog entries label Mar 28, 2019
@pickypg pickypg requested a review from cjcenizal March 28, 2019 20:55
Copy link
Contributor

@cjcenizal cjcenizal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this! Looks great, just had a couple suggestions about a comment.

@pickypg pickypg merged commit 87feadb into master Mar 28, 2019
@pickypg pickypg deleted the wiki/correct-react-router-5x branch March 28, 2019 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Issues or PRs that only affect documentation - will not need changelog entries

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants