This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
Hey everyone, beginner coder here following a CodeWithAntonio React tutorial and trying to replicate it in Sveltekit (doing well thus far).
I noticed that React requires a key for iterative structures, e.g:
<units.map((unit) => (
<div key={unit.id}>
<Unit />
</div>
Before I gave up learning React, I think I learned that this key helps React when modifying iterative structures to ensure it updates the right state for the right elements, etc. (or something like that). Do I need to include some sort of key in my {#each}
blocks, etc. in Svelte? Or does Svelte work some magic here in the background for me? E.g:
{#each units as unit}
<div key={???}>
<Unit />
</div>
{#each}
Subreddit
Post Details
- Posted
- 4 months ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/sveltejs/co...