Skip to content

Expose LocationContext#201

Closed
onnovisser wants to merge 1 commit into
reach:masterfrom
onnovisser:master
Closed

Expose LocationContext#201
onnovisser wants to merge 1 commit into
reach:masterfrom
onnovisser:master

Conversation

@onnovisser

Copy link
Copy Markdown

Exposes LocationContext, so it may be used with static contextType (and useContext when it lands). May need an explanation in the docs as <Location> automatically wraps itself in a <LocationProvider> when needed, which this won't do.

@marcneander

Copy link
Copy Markdown

@ryanflorence This would make my life easier now when hooks are out.

@peter-mouland

Copy link
Copy Markdown

I suspect, if you're going to make this part of the public API, then a test will be needed to guarantee it's existence without accidental breakages. Without any tests, you will probably have little luck in getting this merged.

@ryanflorence

Copy link
Copy Markdown
Member

https://reacttraining.com/blog/reach-react-router-future/

Not going to expose context, but useLocation is coming shortly.

Thanks!

@waynevanson

Copy link
Copy Markdown

If the new API interests you however, the migration should be pretty straightforward. The next React Router API, on the surface, looks more like @reach/router than React Router. Most of the changes have a one-to-one mapping between both APIs and some are identical.

It looks like react-router what we should be using, which at the time of writing is version 5 according to the roadmap is 5.1.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants