Files
react.dev/examples/context/consumer-inline-function-as-a-child.js
Brian Vaughn 797a792b77 Revert "Prettier"
This reverts commit 032576cf7b.
2018-03-29 09:24:38 -07:00

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>
);
}
}