Open kylebakerio opened 1 year ago
Even though they're identical input, one is converted to a string child, one is converted to a vdom object.
Not at all, one is in fact a string, while the other is a vdom object.
To make them equal, you want this:
let mainImage = html`<img src="${images[0]}"></img>`;
html
is what's called a tagged template, which is a way to parse an input with a function. Therefore, it's html
that transforms the string content into the vdom representation. Without it, it's just a string.
specifically, notice these children:
Even though they're identical input, one is converted to a string child, one is converted to a vdom object.
This is pretty annoying. For something this small, I don't want to create a preact element. I find it weird that this option isn't available. Am I missing something? Why does htm not allow this to be parsed as html but insist on keeping it as a string?