Files
react.dev/examples/context/motivation-problem.js
2018-03-23 11:39:12 -07:00

24 lines
476 B
JavaScript

function ThemedButton(props) {
//highlight-range{1}
return <Button theme={props.theme} />;
}
// An intermediate component
function Toolbar(props) {
// highlight-range{1-2,5}
// The Toolbar component must take an extra theme prop
// and pass it to the ThemedButton
return (
<div>
<ThemedButton theme={props.theme} />
</div>
);
}
class App extends React.Component {
render() {
// highlight-range{1}
return <Toolbar theme="dark" />;
}
}