2 ms·
The syntax exists, yes, but the intention of the proposal seems to be that users will use standard JS conditional/looping constructs, and even pushes this as on
by MrJohz 1y ago
The syntax exists, yes, but the intention of the proposal seems to be that users will use standard JS conditional/looping constructs, and even pushes this as one of the reasons that this style of template works so well here. But these are exactly the type of constructs that you need to avoid if you want fine-grained reactive DOM updates.
- throwitaway1123 1y agoJSX was also created with the intention of using traditional conditional/looping constructs, but that hasn't stopped Solid and Preact from repurposing it for fine grained reactivity. Preact's signal implementation has Solid-like Show/For components [1]. I won't speak for the author of the proposal, but given that Lit itself has special control flow mechanisms for conditionals and loops (the cache and repeat directives respectively [2][3]), I can't imagine the proposal being too opposed to these mechanisms. [1] https://github.com/preactjs/signals/blob/eae850a9f3aa62e505a316597c27814dd70be9de/packages/react/README.md#show-component https://github.com/preactjs/signals/blob/eae850a9f3aa62e505a... [2] https://lit.dev/docs/templates/conditionals/#caching-template-results:-the-cache-directive https://lit.dev/docs/templates/conditionals/#caching-templat... [3] https://lit.dev/docs/templates/lists/#the-repeat-directive https://lit.dev/docs/templates/lists/#the-repeat-directive
- MrJohz 1y agoI'm sorry, I don't think I'm being clear enough because we keep on talking past each other here.
- throwitaway1123 1y agoI certainly don't think I'm talking past you, but I can't force you to elaborate.
- throwitaway1123 1y agoThe repeat directive I mentioned as an example of a custom looping control flow construct used in a tagged template is the exact same one another commenter later mentioned (and you responded to) here by the way: https://news.ycombinator.com/item?id=44441002 https://news.ycombinator.com/item?id=44441002