Reputation: 20163
I'm trying to make my first attempt with react.js, I donwloaded the sample project from here
And created a scripts.js like so:
import React from 'react';
class App extends React.Component {
constructor () {
super ();
this.state = {
text: 'Default text'
}
}
update (e) {
this.setState ({text: e.target.value});
}
render () {
return (
<div>
<input onChange={this.update.bind(this)} type="text" />
<div>{this.state.text}</div>
</div>
)
}
}
export default App;
But fires this error
Any idea what i'm doing wrong?
BTW, this is how the .html looks ( screenshot because it uses url-shorteners )
Upvotes: 0
Views: 4558
Reputation: 476
I'm not 100% certain about this, but it looks like you are using ECMA6/7 features in an environment that does not support them.
For a quick and easy project setup, that supports ECMA6/7 you can use create-react-app package
Upvotes: 2