Last active
May 30, 2020 17:13
-
-
Save guillegr123/a1c0df01e822064ef409829dad47b812 to your computer and use it in GitHub Desktop.
phoenix_preact-7-App_index.jsx
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 { h, render, Component, Fragment } from 'preact'; | |
class App extends Component { | |
constructor() { | |
super(); | |
this.state = { count: 0 }; | |
} | |
handleIncreaseClick() { | |
this.setState({ | |
count: this.state.count + 1 | |
}); | |
} | |
render() { | |
return ( | |
<> | |
<h1>Count: {this.state.count}</h1> | |
<button onClick={this.handleIncreaseClick.bind(this)}>Increase!</button> | |
</> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment