According to the documentation: "When a component renders, the tag is replaced with the name of the component, . For example, in the browser console, a component with the template myComponent.html renders as <c-my-component>
, where c is the default namespace."
This way, lwc is adding an extra tag in my DOM. Example:
<tbody>
<c-my-component>
some content
</c-my-component>
</tbody>
Is there a way to avoid adding that extra tag and just put the content? Ex:
<tbody>
some content
</tbody>
Basically, I looking for an equivalent to React Fragment
https://reactjs.org/docs/fragments.html
Best Answer
No. The "extra" element is required for DOM/CSS/event isolation. In LWC, all elements participate in a "closed Shadow DOM" model. Whatever you're trying to do will require a different approach in LWC.