You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
368 B
15 lines
368 B
class Example extends React.Component {
|
|
// This method will be called when the context value changes,
|
|
// But not when the props value changes!
|
|
renderValue = value => {
|
|
return (
|
|
<div>
|
|
Context value:{value}. Props value:{this.props.counter}
|
|
</div>
|
|
);
|
|
};
|
|
|
|
render() {
|
|
return <Ctx.Consumer>{this.renderValue}</Ctx.Consumer>;
|
|
}
|
|
}
|
|
|