import ThemeContext from './theme-context'; import ThemedButton from './button'; class App extends React.Component { state = { theme: { highlight: 'blue', accent: 'purple', }, }; changeHighlightColor = () => { const colors = ['red', 'blue', 'green']; const randomColor = colors[Math.floor(Math.random() * 3)]; this.setState({ theme: { ...this.state.theme, highlight: randomColor, }, }); }; render() { return (
Change Theme
); } } ReactDOM.render(, document.root);