mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-22 20:01:57 +00:00
16 lines
369 B
JavaScript
16 lines
369 B
JavaScript
class Example extends React.Component {
|
|
render() {
|
|
// The inline function will be called when the context value changes,
|
|
// And when the props value changes!
|
|
return (
|
|
<Ctx.Consumer>
|
|
{value => (
|
|
<div>
|
|
Context value:{value}. Props value:{this.props.counter}
|
|
</div>
|
|
)}
|
|
</Ctx.Consumer>
|
|
);
|
|
}
|
|
}
|