Last active
November 23, 2019 02:49
-
-
Save moomdate/bd6f33ca2a8b3c8d4f35d3ff6536a06e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from "react"; | |
| import "./App.css"; | |
| class example extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { data: 0 }; | |
| this.run = this.run.bind(this); | |
| } | |
| run() { | |
| this.setState(state => ({ | |
| data: (this.state.data += 1) | |
| })); | |
| } | |
| render() { | |
| return ( | |
| <div className="App"> | |
| <header className="App-header"> | |
| <h1>React VDOM</h1> | |
| <div class="row"> | |
| <p class="le">number:{this.state.data}</p> | |
| <p class="ri"></p> | |
| </div> | |
| <button class="mbutton" onClick={this.run}> | |
| Hit me | |
| </button> | |
| </header> | |
| </div> | |
| ); | |
| } | |
| } | |
| export default example; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment