This commit is contained in:
dmitry-vsl
2025-05-30 19:59:02 +00:00
parent 1a30311de4
commit 75b1c5e942
30 changed files with 959 additions and 832 deletions

View File

@@ -1,18 +1,15 @@
import {Component} from 'https://unpkg.com/preact?module';
export const Stateful = ({getInitialState, handlers, render}) => {
import { Component } from "preact"
export const Stateful = ({ getInitialState, handlers, render }) => {
return class extends Component {
constructor() {
super()
this.compState = getInitialState()
this.handlers = Object.fromEntries(
Object
.entries(handlers)
.map(([name, h]) =>
[name, this.makeHandler(h)]
)
Object.entries(handlers).map(([name, h]) => [
name,
this.makeHandler(h),
]),
)
}
@@ -27,5 +24,4 @@ export const Stateful = ({getInitialState, handlers, render}) => {
return render(this.props, this.compState, this.handlers)
}
}
}