I playing reactjs v15 on copen. I got unexpected token = error
on line
_handleClick = (e) => {
console.log(ReactDOM.findDOMNode(this.refs.input));
}
Here is my fully react code on codepen: https://codepen.io/dotku/pen/QqwgVV?editors=1010
class Welcome extends React.Component {
_handleClick = (e) => {
console.log(ReactDOM.findDOMNode(this.refs.input));
}
render() {
return <div>
<h1>Hello, {this.props.name}</h1>
<button onKeyPress={this._handleClick}>click</button>
<input ref="input"/>
</div>;
}
}
const element = <Welcome name="Sara" />;
ReactDOM.render(
element,
document.getElementById('root')
);
Anyone has any idea why?