#JSX in select option

2 messages · Page 1 of 1 (latest)

celest leaf
#

Can't seem to add in VSCode, which show in red wangle when I add JSX for default selected option. Might be Astro or TypeScript extension issue?

<select>
    <option {s == 'test1' && 'selected'} value="test1">Test1</option>
</select>

VSCode error
Declaration or statement expected.

grave prism
#

The JSX needs to be in the value of an attribute:

<select>
    <option selected={s == 'test1'} value="test1">Test1</option>
</select>