Lovable ui

React Fragment Key Warning - No Key Prop

Warning: 'Each child in a list should have a unique key prop' when using fragments. Can't add key to <> syntax. Lists don't render correctly with fragment groups.

Fragments in lists need keys when rendering multiple elements per item. Shorthand <> syntax doesn't support keys.

Error Messages You Might See

Keys should be placed on the outermost element Fragment does not accept keys Each child should have a unique key prop

Common Causes

  1. Using <> shorthand fragment in list (can't add key)
  2. Key on parent instead of fragment itself
  3. Not understanding when to use fragments
  4. Mixing fragment and non-fragment items
  5. Complex nested fragments without keys

How to Fix It

Use React.Fragment with key for list items:

// Bad - can't add key to <>  
{items.map(item => (
  <>
    
{item.name}
{item.email}
))} // Good - use React.Fragment with key import { Fragment } from 'react'; {items.map(item => (
{item.name}
{item.email}
))}

Real developers can help you.

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. rayush33 rayush33 JavaScript (React.js, React Native, Node.js) Developer with demonstrated industry experience of 4+ years, actively looking for opportunities to hone my skills as well as help small-scale business owners with solutions to technical problems Pratik Pratik SWE with 15+ years of experience building and maintaining web apps and extensive BE infrastructure BurnHavoc BurnHavoc Been around fixing other peoples code for 20 years. Matthew Jordan Matthew Jordan I've been working at a large software company named Kainos for 2 years, and mainly specialise in Platform Engineering. I regularly enjoy working on software products outside of work, and I'm a huge fan of game development using Unity. I personally enjoy Python & C# in my spare time, but I also specialise in multiple different platform-related technologies from my day job. 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, currently working at Aircall. I'm open to work in various fields! Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services 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 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.

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

Get Help

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