nodebook
Version:
Node.js • Apprendre par la pratique. Familiarisez-vous avec JavaScript, Node.js et l'écosystème de modules npm. Apprenez à concevoir et à déployer des *applications web* et des *outils en ligne de commande*.
31 lines (24 loc) • 667 B
JSX
import React, { Component } from 'react';
export default class ButtonCount extends Component {
constructor(props) {
super(props);
this.handleClick = this.handleClick.bind(this);
this.state = {
clickCount: 0 // <1>
};
}
handleClick () {
this.setState({ clickCount: this.state.clickCount + 1 }); // <2>
}
render() {
let style = {};
// style = {
// fontFamily: 'monospace',
// fontWeight: 'bold',
// textTransform:' uppercase',
// };
return (<button style={style} onClick={this.handleClick}>
Clics : {this.state.clickCount}
</button>);
}
}