hyperviews
Version:
View template language based targeting hyperscript
36 lines (29 loc) • 766 B
HTML
<html>
<body>
<script src="https://unpkg.com/preact@^8"></script>
<!-- <script src="view.js"></script> -->
<!-- <script src="component.js"></script> -->
<script type="module">
import Counter from './view.js'
const { h, Component } = window.preact
window.h = h
class UpDown extends Component {
constructor (props) {
super(props)
this.state = {
count: 0
}
this.render = Counter
this.onClickUp = () => {
this.setState({ count: this.state.count + 1 })
}
this.onClickDown = (e) => {
this.setState({ count: this.state.count - 1 })
}
}
}
preact.render(h(Counter), null, document.body)
</script>
</body>
</html>