Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I didn't look deep into Marko yet, but in my opinion JSX is by far the best HTML template language there is. And it's not restricted to React.

Most other template languages hits serious limitations really fast. I tried and hated (for non trivial things): Angular, Handlebars, Razor (dotnet) and Vue (which does support JSX optionally).



I've been liking the model of the Python library Dominate [1]. You write your HTML as regular Python code, and you render() once at the end, having full control over the formatting. Well, at least in theory; in practice the formatting is brittle and the library otherwise makes some choices I don't like.

I wrote a Rust library with a more restricted/verbose API, and I've been enjoying using that. Unfortunately, I find it really hard to make it as fast as I want. It's really the perfect use case for arena allocation, but doing that and keeping the API as function calls mirroring HTML is not trivial, and probably requires macros to rewrite the tree as a series of stack pushes.

1. https://pypi.org/project/dominate/


Could you please try to be a bit more substantive with your comments?

E.g., Why do you think JSX is the best? What limitations did you hit with those other template languages?


Most template languages can't do something like that:

  // data
  const numbered = true // or false
  const strings = ["a", "b", "c"]

  // render
  const items = strings.map(i => <li key={i}>Item {i}</li>)

  if (numbered)
    return (<ol>{items}</ol>)
  else
    return (<ul>{items}</ul>)


Marko can! It's "define" tag lets you create reusable templates in your reusable templates.

https://markojs.com/docs/reference/core-tag#define


RippleJS is doing the same sort of thing, but better IMO


I written lots of Vue/angular/react (like more than 3 major projects with each) and I'm a firm believer that:

1. Jsx is nicer to write but that's a non issue

2. vue's and angular's directives and bindings lend themselves to much saner and lighter rendering (performance does matter)

3. Vue is much easier to tame, it's reactivity model does not require a PhD in hooks or a deep understanding of React's internals. It just works out of the box as it should and is much easier to control the rendering lifecycle.

At the end of the day, after many years, my preference goes with Vue and Nuxt especially which is tremendously better than the monsters of Next or RR. That's what pays the bill the easiest and is eventually easier to maintain and optimize.


Have you ever given lit html a whirl?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: