Question · Svelte and SvelteKit course · Module 6: Template Logic

The Key in {#each}

Why do we use a key in an {#each} block?

Answer options

  • For better code readability
  • So Svelte can track the identity of items during updates
  • It's required by TypeScript
  • For faster rendering

You can check the correct answer by solving this task in the CodeWorlds game.