import { Component } from "preact";
import "./App.css";
import logo from "./assets/preact-logo.svg";

export default class App extends Component {

	constructor(props) {
		super(props);
		this.increase = this.increase.bind(this);
		this.decrease = this.decrease.bind(this);
		this.state = {
			count: 0
		};
	}

	decrease() {
		this.setState({
			count: this.state.count - 1
		});
	}

	increase() {
		this.setState({
			count: this.state.count + 1
		});
	}

	render() {
		var { count } = this.state;
		return <>
			<img src={logo} alt="Preact" />
			<h1>Hello Preact!</h1>
			<div>
				<button type="button" onClick={this.decrease}>-</button>
				{count}
				<button type="button" onClick={this.increase}>+</button>
			</div>
		</>;
	}
}
