Episode 11 game · Chitragupta · Water
Catch the Key Thief
Kai ticks a quest, deletes it, and the next quest turns up ticked. Feel the tanuki swap name tags for seat numbers when a list is keyed by index, choose a key that belongs to the item, then prove every tick stays put through delete, add and sort.
Rendered with key={i}
Each key gets one line. A row’s tick lives on its key’s line.
1 · Feel the theft
This list follows React’s rule: state is matched to rows by key, and Kai keys by index. Tick a quest, then change the order.
2 · Give every quest a name
Pick the key that belongs to the quest, then decide where its id comes from.
3 · The ledger audit
Same quests, your keys. Tick two quests, then delete, add to the top and sort A→Z. Every tick must stay with its own quest.
New seal earned
The thief ran out of tags
Acharya’s Rule #11Key each item by who it is, not where it sits.
React matches rows by key and keeps each key’s state and DOM.
Delete, add or sort and key={i} hands one item’s state to another.
Create an id with the item (crypto.randomUUID() or the database id) and key by it.