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

NullVoxPopuli left a comment (WICG/webcomponents#1069)

what if I want just one `{}` region to update? as it it _seems like_ that if any `{}` region is to update, the _whole_ `html\`\``, seems to have to rerender? (did I miss something in the proposal?) -- otherwise it seems fine if you want virtualDOM (like React's) -- but I do not.

I suppose, maybe extrapolating a bit -- 

<img width="619" height="398" alt="Image" src="https://github.com/user-attachments/assets/8ae3bbf9-e715-4a6f-8e2e-01eb0755b2d0" />

I don't know how this effect comes in to anything (i chopped it off at the top of the screen) -- but somehow a "part" is passed to "something" that updates when the signal is set.

I'm kinda hoping for some example, that maybe can be interpeted in the following way:
```js
const templ = html`
  ${
    if(
      // condition
      () => conditionSignal.get(),
      // truthy case
      // only evaluated if condition is true
      () => html`
        <button>
          ${() => signal.get()} -- reading is lazy, and only if rendered
        </button>
      `, 
      // falsey case
      '',
    )
  }
`;
```
and then, even then, I don't quite grok how a framework author gets access to the "parts" to update the parts of the DOM that changes.

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

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

Received on Sunday, 9 November 2025 20:43:57 UTC