4 ms·
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 templ
by andix 1y ago
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).
- joshdavham 1y agoCould 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?
- andix 1y agoMost 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>)
- deleted 1y ago[deleted]
- Rendello 1y agoI'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/ https://pypi.org/project/dominate/
- epolanski 1y agoI 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.
- mock-possum 1y agoHave you ever given lit html a whirl?