App

Bundles

Stats
BundleMinifiedGzipBrotli
index.js9.59 kB3.9 kB3.55 kB

Source

import { Component, render } from "preact";

class App extends Component {
	constructor() {
		super();
		this.state = { value: 0 };
	}

	render(props, state) {
		return (
			<button
				class="btn badge"
				data-badge={state.value}
				style="margin-top: .5rem"
				onClick={() => this.setState({ value: state.value + 1 })}
			>
				count: {state.value}
			</button>
		);
	}
}

render(<App />, document.getElementById("app"));