Web Components: near miss or missing out?

Поделиться
HTML-код
  • Опубликовано: 23 ноя 2024

Комментарии •

  • @retributionbyrevenue3703
    @retributionbyrevenue3703 2 месяца назад +1

    This has been one of the best discussions about web components I've ever heard

  • @JLarky
    @JLarky 2 месяца назад +2

    39:03 web components are great for design systems
    57:39 opinions in frameworks
    1:04:17 performance
    1:26:45 how *I* use web components

  • @richard_anaya
    @richard_anaya 2 месяца назад +2

    You should look into declarative shadow dom. To my knowledge that avanue is where SSR web components will come from.

    • @michaelwarren829
      @michaelwarren829 2 месяца назад +2

      DSD is an output format that server libs can create on the server! that all works and is largely available in browsers. there’s more tweaking to do on the format and reducing repeated dom/styles, but it’s there. the hard part is figuring out how to render native WC source code into DSD on the server. one of the major hard parts is know where the template is and/or what hooks to run etc. that’s why libs like Lit can have SSR packages but native WCs can’t. Lit has a defined way of building, native WCs don’t

  • @x-dr6uh
    @x-dr6uh 17 дней назад

    You don't need ssr. If you need ssr, you probably are making websites, not web apps

    • @ParasocialFix
      @ParasocialFix  17 дней назад

      Yes, that's exactly what I'm building

  • @DannyEngelman
    @DannyEngelman 2 месяца назад +2

    Maybe do:
    customElements.define("reveal-button", class extends HTMLElement {
    get cats() {
    return (this.getAttribute("cats") || "").split(",");
    }
    connectedCallback() {
    const catcount = this.cats.length;
    this.replaceWith(
    this.button = Object.assign(document.createElement("button"), {
    textContent: `Reveal one of the ${catcount} cat names`,
    onclick: () => {
    this.button.textContent = this.cats[~~(Math.random() * catcount)];
    }
    })
    );
    }
    });