Browse Source

kill class props

main
Alex Krolick 7 years ago
parent
commit
fb8e9e8a1b
  1. 26
      examples/context/theme-detailed-app.js

26
examples/context/theme-detailed-app.js

@ -11,18 +11,20 @@ function Toolbar(props) {
}
class App extends React.Component {
state = {
theme: themes.light,
};
toggleTheme = () => {
this.setState(state => ({
theme:
state.theme === themes.dark
? themes.light
: themes.dark,
}));
};
constructor(props) {
this.state = {
theme: themes.light,
};
this.toggleTheme = () => {
this.setState(state => ({
theme:
state.theme === themes.dark
? themes.light
: themes.dark,
}));
};
}
render() {
//highlight-range{1-3}

Loading…
Cancel
Save