Lovable ui

React Key Prop Warning in Lists

Console warning: 'Each child in a list should have a unique key prop'. List re-renders cause wrong components to update. List items in wrong order after dynamic changes.

React uses keys to identify list items. Without unique keys, React reuses component instances incorrectly.

Error Messages You Might See

Each child in a list should have a unique key prop Warning: Each child in a React list
Each child in a list should have a unique key propWarning: Each child in a React list

Common Causes

  1. No key prop on list items
  2. Using index as key (breaks when list reorders)
  3. Key not unique across siblings
  4. Key changes on re-render
  5. Using Math.random() for key generation

How to Fix It

Use unique, stable identifiers as keys:

// Bad - using index
{items.map((item, index) => 
  
{item.name}
)} // Good - using unique ID {items.map((item) =>
{item.name}
)} // Good - using combination if no ID {items.map((item) =>
{item.name}
)}

Real developers can help you.

Richard McSorley Richard McSorley Full-Stack Software Engineer with 8+ years building high-performance applications for enterprise clients. Shipped production systems at Walmart (4,000+ stores), Cigna (20M+ users), and Arkansas Blue Cross. 5 patents in retail/supply chain tech. Currently focused on AI integrations, automation tools, and TypeScript-first architectures. Costea Adrian Costea Adrian Embedded Engineer specilizing in perception systems. Latest project was a adas camera calibration system. MFox MFox Full-stack professional senior engineer (15+years). Extensive experience in software development, qa, and IP networking. Taufan Taufan I’m a product-focused engineer and tech leader who builds scalable systems and turns ideas into production-ready platforms. Over the past years, I’ve worked across startups and fast-moving teams, leading backend architecture, improving system reliability, and shipping products used by thousands of users. My strength is not just writing code — but connecting product vision, technical execution, and business impact. BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Nam Tran Nam Tran 10 years as fullstack developer Milan Surelia Milan Surelia Milan Surelia is a Mobile App Developer with 5+ years of experience crafting scalable, cross-platform apps at 7Span and Meticha. At 7Span, he engineers feature-rich Flutter apps with smooth performance and modern UI. As the Co-Founder of Meticha, he builds open-source tools and developer-focused products that solve real-world problems. Expertise: 💡 Developing cross-platform apps using Flutter, Dart, and Jetpack Compose for Android, iOS, and Web. 🖋️ Sharing insights through technical writing, blogging, and open-source contributions. 🤝 Collaborating closely with designers, PMs, and developers to build seamless mobile experiences. Notable Achievements: 🎯 Revamped the Vepaar app into Vepaar Store & CRM with a 2x performance boost and smoother UX. 🚀 Launched Compose101 — a Jetpack Compose starter kit to speed up Android development. 🌟 Open source contributions on Github & StackOverflow for Flutter & Dart 🎖️ Worked on improving app performance and user experience with smart solutions. Milan is always happy to connect, work on new ideas, and explore the latest in technology. Yovel Cohen Yovel Cohen I got a lot of experience in building Long-horizon AI Agents in production, Backend apps that scale to millions of users and frontend knowledge as well. Krishna Sai Kuncha Krishna Sai Kuncha Experienced Professional Full stack Developer with 8+ years of experience across react, python, js, ts, golang and react-native. Developed inhouse websearch tooling for AI before websearch was solved : ) Stanislav Prigodich Stanislav Prigodich 15+ years building iOS and web apps at startups and enterprise companies. I want to use that experience to help builders ship real products - when something breaks, I'm here to fix it.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help

Frequently Asked Questions

Why not use index as key?

Index changes when list reorders. React reuses wrong component instances. Only use index if list is static.

What makes a good key?

Unique, stable, not derived from other data. IDs from database are ideal. Avoid generating keys from data.

Related Lovable Issues

Can't fix it yourself?
Real developers can help.

You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.

Get Help