#index #handler
import React from 'react';
import ReactDOM from 'react-dom';
import * as serviceWorker from './serviceWorker';
class App extends React.Component {
constructor () {
super();
this.state = {
message: 'default message',
counter: 1
}
this.onStateButtonClick = this.onStateButtonClick.bind(this);
}
onStateButtonClick(event) {
this.setState({message: "Changed !"})
this.setState({counter: this.state.counter+1})
}
onSocketButtonClick(event) {
}
render () {
return (
<div>
Hello world @LATITUDE : {this.state.message + this.state.counter}<br/>
<button id="StateButton" onClick={this.onStateButtonClick} >Update this.state !</button><br/>
<button id="SocketButton" >Emit socket !</button>
</div>
)
}
}
ReactDOM.render(<App />, document.querySelector('#root'));
serviceWorker.unregister();