Don’t require <astro-root>
for client directives.
#33
Replies: 1 comment 2 replies
-
I don't think the premise here is quite right. The For custom elements there is a single root element. It's possible (even likely) that some other non-WC frameworks also require a single root element, in which case I think this is simply an implementation detail we can change without an RFC. We can have a flag on a renderer, something like |
Beta Was this translation helpful? Give feedback.
-
I like Web Components. I’ve been slowly trying to carve out a space for them in Astro. 1 2 3 4 5
Of maybe two roadblocks left; one of them is
<astro-root>
.<astro-root>
is an element that wraps any component using client directives.The
<astro-root>
element exists so that frameworks needing a container for hydration get one.No, Web Components don’t need an
<astro-root>
container at all.Web Components get
<astro-root>
because Astro forbids components from automatically hydrating themselves. To hydrate a component, we have to add a client directive. And when we add a client directives, the component gets the<astro-root>
wrapper.Yes.
Listen, the
<astro-root>
element can be helpful to frameworks like React and Vue, but it’s not helpful to frameworks like Lit, Atomico, or... the web platform. See the unnecessary<astro-root>
in framework-lit.I’d like to change renderers so
<astro-root>
is optional.AFAIK, there isn’t resistance to this.
Beta Was this translation helpful? Give feedback.
All reactions