// Theme context, default to light theme const ThemeContext = React.createContext('light'); // Signed-in user context const UserContext = React.createContext({ name: 'Guest', }); class App extends React.Component { render() { const {signedInUser, theme} = this.props; // App component that provides initial context values // highlight-range{2-3,5-6} return ( ); } } function Layout() { return (
); } // A component may consume multiple contexts function Content() { // highlight-range{2-10} return ( {theme => ( {user => ( )} )} ); }