import { withComponent } from 'skatejs'; import withPreact from '@skatejs/renderer-preact'; import htm from 'htm'; import { h } from 'preact'; import { State } from 'haunted'; export const html = htm.bind(h); const Base = withComponent(withPreact()); export default class extends Base { constructor() { super(); this.hauntedState = new State(() => this.triggerUpdate(), this); } renderer(...args) { this.hauntedState.run(() => super.renderer(...args)); this.hauntedState.runEffects(); } }