This repository has been archived on 2022-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
hydrogen-web/documentation/UI/render-dom-elements.md
RMidhunSuresh 4d79279f42 Add some content
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
2021-06-08 21:13:52 +05:30

669 B

There are two options to render DOM elements:

  • Use tag from ui/general/html.js
  • Use TemplateBuilder object (t) from the render function in the view.

Although syntactically similar, they are not functionally equivalent.
Primarily tag does not support bindings nor event handlers.

    // The onClick here wont work!!
    tag.button({className:"awesome-btn", onClick: () => this.foo()});

For these functionalities always use the TemplateBuilder object that is passed as argument to the render method.

    render(t, vm){
        // The onClick works here.
        t.button({className:"awesome-btn", onClick: () => this.foo()});
    }