3 ms·
Great stuff, but if you are writing your own components just stick to light DOM and do not write code to generate DOM elements for the component to look right.
by sirwhinesalot 2y ago
Great stuff, but if you are writing your own components just stick to light DOM and do not write code to generate DOM elements for the component to look right.
Let's say you are making a splitter component. Do not do this:
<my-splitter>
<div slot="left">
<my-handle slot="handle">
<div slot="right">
</my-splitter>
With some divs on the inside assigned to slots. Instead do this:
<my-splitter>
<div data-slot="left">
<my-handle data-slot="handle">
<div data-slot="right">
</my-splitter>
Looks almost the same right? Except the one at the bottom is trivially server-side rendered. *It already is*.
Stay on the light side.