News for hackers. Stuff that matters.
Re:Virtual DOM is pure overhead (2018) by wruza on Tuesday June 29, 2021 @10:25AM (#27676206)
And for me, both are unnecessary overcomplicated abstractions over mithril+js based classical MVC (not web-renamed one):

  class App {
    constructor() {
      this.message = 'Hello'
      this.foo = new Foo
      this.show_foo = true
    }
    bye() {
      this.message = 'Bye'
      this.show_foo = false
    }
  }

  class AppView {
    view({attrs:{app}}) {
      const attrs = {
        onclick: (e) => app.bye(),
      }
      return m('div.container', [
        m('h1', attrs, 'Hello!'),
        (app.show_foo
          ? m(FooView, {foo:app.foo}),
          : null),
        this.render_footer(app),
      ])
    }
    render_footer(app) {
      return m(…)
    }
  }

  window.app = new App

  m.mount(document.all.root, {
    view: () => m(AppView, {app}))
  })

There are no comments on this comment yet.