react jsx - Material-ui example -


i got code snippet material-ui(simple example) website , seems doesn't work copying , paste directly.

it throws error unexpected token ("line#") while parsing, particularly in handlechange = ....... . i'm using visual studio code , i'm new using material-ui in jsx.

what missing? please help.

import react 'react'; import dropdownmenu 'material-ui/lib/dropdownmenu'; import menuitem 'material-ui/lib/menus/menu-item';  export default class dropdownmenusimpleexample extends react.component {    constructor(props) {     super(props);     this.state = {value: 2};   }    handlechange = (event, index, value) => this.setstate({value});    render() {     return (       <dropdownmenu value={this.state.value} onchange={this.handlechange}>         <menuitem value={1} primarytext="never"/>         <menuitem value={2} primarytext="every night"/>         <menuitem value={3} primarytext="weeknights"/>         <menuitem value={4} primarytext="weekends"/>         <menuitem value={5} primarytext="weekly"/>       </dropdownmenu>     );   } } 

change handlechange = (event, index, value) => this.setstate({value}); to

handlechange(event, index, value) {     this.setstate({value}) }; 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -