How would I conditionally add element attributes? This doesn’t seem to work with the data-color attribute (it doesn’t appear at all):
const __color = child.data.color ? `data-color="${child.data.color}"` : '';
return $h `
<div class="treeview-item" data-id="${child.id}" data-type="${child.type}" ${__color}>
.....
</div>
`
Is there a way to conditionally build up attributes on an element?