Created
January 27, 2018 12:06
-
-
Save jgierer12/ca0f1001fa2a0920f892fa754e600653 to your computer and use it in GitHub Desktop.
Try it online! codepan.net/gist/ca0f1001fa2a0920f892fa754e600653
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
{ | |
"showPans": [ | |
"js", | |
"output" | |
], | |
"activePan": "js" | |
} |
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
<script src="https://unpkg.com/[email protected]/dist/preact.js"></script> |
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
/* @jsx h */ | |
const { Component, h, render } = preact | |
class App extends Component { | |
state = { | |
count: 0 | |
} | |
inc = () => this.setState({ | |
count: this.state.count + 1 | |
}) | |
dec = () => this.setState({ | |
count: this.state.count - 1 | |
}) | |
render() { | |
return ( | |
<div> | |
<h2>{ this.state.count }</h2> | |
<button onClick={this.inc}>Increment</button> | |
<button onClick={this.dec}>Decrement</button> | |
</div> | |
) | |
} | |
} | |
render(<App />, document.body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment