score:0

you need a transpiler that converts it to es5, afterwards pipe it in the gulp task. i use babel and there is a gulp-babel npm package

score:0

i changed my code to this, when using the older version the transpiling works. import react from 'react' throws an error.

// var react = require('react');
import react from 'react';

class udpcomp extends react.component {

  constructor (props){
     super(props);
     this.state = { udpinput: this.props.udpinput };
  }


  render () {
    return(
        <div classname="udptext">
            <h2>udp-input: {this.state.udpinput}</h2>
       </div>
    ) // return
  } // render



}; // udpcomp

module.exports = udpcomp;
// export default udpcomp;

score:1

can't see what's on line 14 but i'd guess it's the comma right after your constructor. as opposed to es5 "classes", es6 classes don't require (and don't allow) commas between methods. just remove it and it should work (or at least get past line 14)


Related Query

More Query from same tag