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

Stop masking context #9266

Closed
gingur opened this issue Mar 27, 2017 · 5 comments
Closed

Stop masking context #9266

gingur opened this issue Mar 27, 2017 · 5 comments

Comments

@gingur
Copy link

gingur commented Mar 27, 2017

Feature

Return all contextProps available via a wildcard prop, this would be helpful for those who want to do shouldComponentUpdate comparisons with props, state, and context.

Possible solutions

static contextTypes = true;
// or
static contextTypes = /.*/;
// or
static contextTypes = {
  __all: true
}
@brigand
Copy link
Contributor

brigand commented Mar 28, 2017

This could also be used in the case where you ReactDOM.render inside a component and want to preserve things like the redux store and react-router.

@gingur
Copy link
Author

gingur commented Mar 28, 2017

That's a great point @brigand! Passing, cloning, or even serializing the context data could benefit from this feature.

@gaearon
Copy link
Collaborator

gaearon commented Oct 4, 2017

We'll be changing how context works, and I don't think properly exposing it in shouldComponentUpdate in the current form is a goal.

That said we'll probably get rid of masking so I'll hijack this issue to track it.

@gaearon gaearon changed the title Wildcard support for contextProps Stop masking context Oct 4, 2017
@gingur
Copy link
Author

gingur commented Oct 6, 2017

I don't know what that means, but as long as I can prevent wasted renders based on props, state and context I'm a happy camper. If this is something that can automatically be handled by PureComponent even better :)

@gaearon
Copy link
Collaborator

gaearon commented Jan 2, 2018

The proposed context API solves this (reactjs/rfcs#2) and we don't plan changes to the existing one so I think this is not relevant anymore.

@gaearon gaearon closed this as completed Jan 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants