Created
April 10, 2017 05:12
-
-
Save ambethia/391df2ed6f174fbfd125d38cf96371ef to your computer and use it in GitHub Desktop.
A simple React counter.
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' | |
class App extends Component { | |
state = { | |
count: 0 | |
} | |
_click = () => { | |
this.setState({ | |
count: this.state.count + 1 | |
}) | |
} | |
render () { | |
return <div> | |
<h1>{this.state.count}</h1> | |
<button onClick={this._click}>+</button> | |
</div> | |
} | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment