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. Tejas Chokhawala Tejas Chokhawala Full-stack engineer with 5 years experience building production web apps using React, Next.js and TypeScript. Focused on performance, clean architecture and shipping fast. Experienced with Supabase/Postgres backends, Stripe billing, and building AI-assisted developer tools. Victor Denisov Victor Denisov Developer legrab legrab I'll fill this later Dor Yaloz Dor Yaloz SW engineer with 6+ years of experience, I worked with React/Node/Python did projects with React+Capacitor.js for ios Supabase expert Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure Basel Issmail Basel Issmail ’m a Senior Full-Stack Developer and Tech Lead with experience designing and building scalable web platforms. I work across the full development lifecycle, from translating business requirements into technical architecture to delivering reliable production systems. My work focuses on modern web technologies, including TypeScript, Angular, Node.js, and cloud-based architectures. I enjoy solving complex technical problems and helping teams turn product ideas and prototypes into working platforms that can grow and scale. In addition to development, I often collaborate closely with product managers, business analysts, designers, and QA teams to ensure that solutions align with both technical and business goals. I enjoy working with startups and product teams where I can contribute both as a hands-on engineer and as a technical partner in designing and delivering impactful software. Antriksh Narang Antriksh Narang 5 years+ Experienced Dev (Specially in Web Development), can help in python, javascript, react, next.js and full stack web dev technologies. 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. Jaime Orts-Caroff Jaime Orts-Caroff I'm a Senior Android developer, open to work in various fields

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