Reputation: 253
I'm trying to use the http://www.material-ui.com/#/components/drawer (Docked Example) component from Material-UI with ReactJS.
I get error an error on the "=" in the following line:
handleToggle = () => this.setState({open: !this.state.open});
I get the same error on some other components as well. I'm using the latest version of Material-UI.
Same with this one: http://www.material-ui.com/#/components/table (Complex Example) on the following code:
handleToggle = (event, toggled) => {
Any ideas?
Thank you.
Upvotes: 0
Views: 1161
Reputation: 253
Thanks for the input. I just had to add "stage-0" to my loaders and install "babel-preset-stage-0". Now everything works. Thanks again.
Upvotes: 0
Reputation: 3780
You'll either need to use an ES6 transpiler such as babel to convert your code to JS that current browsers can understand, or not use fat-arrow functions:
handleToggle() {
this.setState({open: !this.state.open});
};
Upvotes: 1