I have a component in react defined by extends React.Component. Inside it, along with the render method, is:
constructor(props, context) {
super(props, context);
this.state = {
open: false,
};
}
handleClose = () => { //this works
this.setState({open: false});
};
handleOpen = () => { //this works
this.setState({open: true});
};
let empty = () => {}; // does not work, error Parsing error: Unexpected token
I seem to get an unexpected token error if I prefix any of the arrow functions with let or const. Am I missing something here?
thanks