Skip to content

"Keyed each blocks" in the tutorial should explain the need for keys #1644

@psncl

Description

@psncl

So I had briefly talked on Discord last month about how the Svelte tutorial doesn't really explain the conceptual background behind unique keys in keyed each blocks. One of your maintainers replied in the channel that this does seem like something that should be explained more clearly.

The tutorial page for keyed each block sort of (I feel) prematurely jumps into demonstrating it instead of introducing the need for unique keys. When I first learned Svelte, I had a lot of trouble understanding it. It wasn't until I read React tutorial's equivalent explanation that I understood why exactly keys were needed.

Would it be a worthwhile addition to explain briefly why items in a list should be uniquely identified, in a similar manner as primary keys in a relational DB table perhaps?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions