Lit: Update on reflected attribute change

Viewed 35

I have a custom element: my-form, which renders another custom element: my-select.

my-select has a property called option-checked. This property is defined with { reflect: true }, so when an option is checked its attribute is updated in the DOM.

@customElement('my-form')
export class MyForm extends LitElement {

  // ...

  render() {
    return html`
      <my-select
        .options=${this.options}
        option-checked="foo"
      ></my-select>
    `;
  }
}

In the my-form custom element I want to watch for changes to the option-checked attribute and update when this happens.

How can I do this?

0 Answers
Related