4 ms·
> Speaking of writing javascript instead of JSX, I'm a big fan of the hyperscript approach Speaking of writing JS instead of JSX or your example, I like the va
by dualogy 11mo ago
> Speaking of writing javascript instead of JSX, I'm a big fan of the hyperscript approach
Speaking of writing JS instead of JSX or your example, I like the vanjs.org approach:
const Hello = () => div(
p("Hello"),
ul(
li("World"),
li(a({href: "https://vanjs.org/"}, "VanJS")),
),
)
van.add(document.body, Hello())
- insin 11mo agoJSX was such a breath of fresh air after having written and maintained apps which used both of these formats for years (and also having written a library which supported both of them for reusing the same templates on the server and in the browser) - it's the commas! I'm glad it's everywhere now. But that was also back in the days when trailing commas at the end could break things, JavaScript editor support was relatively poor, and tooling wasn't where it is now (knowing your code is once again valid because the autoformatter just kicked in).
- mb2100 11mo agoSince we're sharing HTML in JS syntaxes. Don't forget JS tagged template literals like https://jsr.io/@mastrojs/mastro/doc/~/html https://jsr.io/@mastrojs/mastro/doc/~/html
- nymanjon 11mo agoMastro looks like what I do for my offline-first, rendered from Service Workers. I just compose html template string literals and stream them back to the front end. The lib I use for HTML is a bit more powerful though. It is a very elegant way to program. https://github.com/jon49/Soccer https://github.com/jon49/Soccer
- mb2100 11mo agoThanks, this one? https://github.com/jon49/html-template-tag-async https://github.com/jon49/html-template-tag-async Looks very similar indeed! What makes it "more powerful" than Mastro's html template?