Adding Selected Property with Router Component

In a loop, I want to add a selected attribute to the option element if it fits my condition.

${, i) => this.$h`
    <option value="${item}" ${i === 0 && "selected"}>Text</option>`)}

It doesn’t work this way.

I found the solution.

(Conditional element attributes not working using templates - #2 by nolimits4web)

${, i) => this.$h`
    <option value="${item}" selected=${i === 0}>Text</option>`)}

If it is undefined it won’t be rendered