←back to thread

69 points jdkoeck | 2 comments | | HN request time: 0s | source
Show context
maxloh ◴[] No.44437012[source]
I don't understand why Svelte isn't even mentioned. Its syntax is more readable for me.

  <div>
    {#each colors as color, i}
      <button
        style="background: {color}"
        aria-label={color}
        aria-current={selected === color}
        onclick={() => selected = color}
      >
        {i + 1}
      </button>
    {/each}
  </div>
replies(4): >>44437120 #>>44437268 #>>44437428 #>>44437574 #
1. cluckindan ◴[] No.44437428[source]
I think you meant to use color in a variable interpolation instead of ”red”. Now the code only makes red buttons.
replies(1): >>44437766 #
2. maxloh ◴[] No.44437766[source]
Yeah, you're right.

The code came directly from Svelte's official tutorials. Looks like I accidentally copied the problem instead of the solution!