-
Notifications
You must be signed in to change notification settings - Fork 48.1k
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
0.14.0-alpha1 children with parent-based context changes don't update #4218
Comments
Fixes facebook#4218 But not well
I'm seeing this same behavior in import React from 'react';
class Holder extends React.Component {
render() {
return <Parent><Child /></Parent>;
}
}
class Parent extends React.Component {
static childContextTypes = {
value: React.PropTypes.number.isRequired
};
constructor(props, context) {
super(props, context);
this.state = {value: 1};
}
getChildContext() {
const {value} = this.state;
return {value};
}
componentDidMount() {
this.setState({value: 2});
}
render() {
return <div>{this.props.children}</div>;
}
}
class Child extends React.Component {
static contextTypes = {
value: React.PropTypes.number.isRequired
};
render() {
return <div>{this.context.value}</div>;
}
}
export default <Holder />; I end up with To get this to work correctly, I have to render |
I think #4344 fixes that (happened after beta3) but it would be good to double-check. |
Oops - didn't realize that some of those PRs above were after beta3. This indeed works as expected against the current commit on master. Thank you! |
The text was updated successfully, but these errors were encountered: