Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Living wiki of UI design patterns and best practices built with Fumadocs, Next.js, and Base UI components.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
rules/exit-key-required.md
1---2title: Unique Keys in AnimatePresence Lists3impact: HIGH4tags: exit, key, list5---67## Unique Keys in AnimatePresence Lists89Dynamic lists inside AnimatePresence must have unique keys.1011**Incorrect (index as key):**1213```tsx14<AnimatePresence>15{items.map((item, index) => (16<motion.div key={index} exit={{ opacity: 0 }} />17))}18</AnimatePresence>19```2021**Correct (stable unique key):**2223```tsx24<AnimatePresence>25{items.map((item) => (26<motion.div key={item.id} exit={{ opacity: 0 }} />27))}28</AnimatePresence>29```30