DEV Community

loading...

Discussion on: Learn basic Web Components

bennypowers profile image
Benny Powers 🇮🇱🇨🇦

if you know you're only going to use the element once, yeah there's no difference.

But if you're going to construct the element several times, then you're going to invoke the parser on each instance.

If the element's shadow DOM is extensive, that could add up fast.

Moreover, keeping the template static means it's parsed up front.

Forem Open with the Forem app