Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing class properties transform

Tags:

reactjs

meteor

So i have just tried to get the google material dialog box. I am very new to meteor and react so the answare might be more obvious for you then for me.

even so, my console are giving me this error:

Missing class properties
   transform.

on line 16 in this file:

export default class DialogExampleCustomWidth extends React.Component {

  state = {
    open: false,
  };

  handleOpen = () => {
    this.setState({open: true});
  };

  handleClose = () => {
    this.setState({open: false});
  };

  render() {
    const actions = [
      <FlatButton
        label="Cancel"
        primary={true}
        onTouchTap={this.handleClose}
      />,
      <FlatButton
        label="Submit"
        primary={true}
        onTouchTap={this.handleClose}
      />,
    ];

    return (
      <div>
        <RaisedButton label="Dialog With Custom Width" onTouchTap={this.handleOpen} />
        <Dialog
          title="Dialog With Custom Width"
          actions={actions}
          modal={true}
          contentStyle={customContentStyle}
          open={this.state.open}
        >
          This dialog spans the entire width of the screen.
        </Dialog>
      </div>
    );
  }
}

the error appears on the state = { i have read on multiple articals but can't seem to get it. Thank you for your help and time

like image 386
Peter Hughes Avatar asked Jan 05 '23 04:01

Peter Hughes


1 Answers

Meteor does not support arrow functions by default, but today you can simply change that:

add the following package:

meteor npm install --save-dev babel-plugin-transform-class-properties

Edit your package.json in your project and add there the following to make the package work:

 "babel": {
    "plugins": ["transform-class-properties"]

  }
like image 162
henk Avatar answered Jan 07 '23 19:01

henk