Skip to content

Instantly share code, notes, and snippets.

@guillegr123
Last active May 30, 2020 17:13
Show Gist options
  • Save guillegr123/a1c0df01e822064ef409829dad47b812 to your computer and use it in GitHub Desktop.
Save guillegr123/a1c0df01e822064ef409829dad47b812 to your computer and use it in GitHub Desktop.
phoenix_preact-7-App_index.jsx
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