dev:reactdiver
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| dev:reactdiver [2021/12/28 13:10] – sbestel | dev:reactdiver [2021/12/28 13:30] (Version actuelle) – sbestel | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | > console.log(id) | ||
| Ligne 13: | Ligne 14: | ||
| ===== THIS ===== | ===== THIS ===== | ||
| - | handleclick() { console.log(" | ||
| === avec BIND === | === avec BIND === | ||
| + | |||
| + | handleclick() { console.log(" | ||
| <button onClick={this.handleclick.bind(this)}> | <button onClick={this.handleclick.bind(this)}> | ||
| - | === avec zero fonction === | + | === avec zero fonction |
| - | <button onClick={ | + | handleclick() { console.log(" |
| + | <button onClick={ () => this.handleclick()}> | ||
| - | === avec fonction fléchée === | + | === avec fonction fléchée |
| - | chandleclick | + | handleclick |
| | | ||
| < | < | ||
| | | ||
| + | ==== SETSTATE ==== | ||
| + | |||
| + | |||
| + | | ||
| + | this.setState({compteur: | ||
| + | console.log(this.state); | ||
| + | } | ||
| + | ou | ||
| + | handleclick = () => { | ||
| + | const clients = this.state.clients.slice(); | ||
| + | clients.push({id: | ||
| + | this.setState({clients: | ||
| + | }; | ||
| | | ||
dev/reactdiver.1640697023.txt.gz · Dernière modification : 2021/12/28 13:10 de sbestel
