Re: [WICG/webcomponents] [templates] A declarative JavaScript templating API (Issue #1069)

justinfagnani left a comment (WICG/webcomponents#1069)

@EisenbergEffect 

> A JSX transform could improve ergonomics and produce this output

I actually think that such a transform isn't necessarily good for ergonomics. While it does reduce the raw character count, it pretty drastically changes the semantics of JavaScript.

An expression like this:
```tsx
const App = (user) => <h1>Hello {user.firstName + user.lastName}</h1>;
```

_Looks_ like the expression `user.firstName + user.lastName` is always and only executed when the `App` function is executed. The expression isn't in a conditional, loop, or a function, and JavaScript has sequential statement and expression execution. It's a big departure to say it can now be reevaluated multiple times.

`()=>` is the way we signify that something can be executed multiple times. Maybe there's some sigil still available to make that shorter, but absent that I worry that making app JSX expressions into closures would be prohibitively expensive for some use cases.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1069#issuecomment-3508892769
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1069/3508892769@github.com>

Received on Sunday, 9 November 2025 22:25:03 UTC