Created
June 13, 2016 12:35
-
-
Save chuck0523/276d714f3d4e67f92c725a20e180e93f to your computer and use it in GitHub Desktop.
This file contains 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 Counter extends Component { | |
constructor() { | |
super() | |
this.state = { | |
count: 0 | |
} | |
} | |
render() { | |
return ( | |
<div> | |
<p>Count: {this.state.count} </p> | |
<button onClick={e => this.increment()}>Increment</button> | |
</div> | |
) | |
} | |
increment() { | |
this.setState({ | |
count: this.state.count + 1 | |
}) | |
} | |
} | |
export default Counter |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment