Hacker News new | ask | show | jobs
by eterps 1068 days ago
I appreciate that in JSX, functions can be used as if they were first-class elements.

In this case that would be accomplished by supporting the following instead:

    @hmlt HomePage() {
      %SiteLayout
        %p This is the home page for Hamlet.
    }
Which is much cleaner IMO.
1 comments

Because JSX is just document.createElement() with syntax sugar. If Haml has an equivalent api, there should be a way to implement something similar.
I don't understand, I thought document.createElement() is independent of JSX. JSX works just as well in Deno/Bun/Node.js without DOM functions.
I haven't looked into the details about how server side rendering is done. It should have something equivalent to generate HTML. But the point still stands, it should be possible to follow the same pattern to create a JSXesque template for HAML