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
Keys should be placed on the outermost elementFragment does not accept keysEach 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.

Jen Jacobsen Jen Jacobsen I’m a Full-Stack Developer with over 10 years of experience building modern web and mobile applications. I enjoy working across the full product lifecycle — turning ideas into real, well-built products that are intuitive for users and scalable for businesses. I particularly enjoy building mobile apps, modern web platforms, and solving complex technical problems in a way that keeps systems clean, reliable, and easy to maintain. 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. Anthony Akpan Anthony Akpan Developer with 8 years of experience building softwares fro startups 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. legrab legrab I'll fill this later Mehdi Ben Haddou Mehdi Ben Haddou - Founder of Chessigma (1M+ users) & many small projects - ex Founding Engineer @Uplane (YC F25) - ex Software Engineer @Amazon and @Booking.com Victor Denisov Victor Denisov Developer 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 : ) Matthew Butler Matthew Butler Systems Development Engineer @ Amazon Web Services Daniel Vázquez Daniel Vázquez Software Engineer with over 10 years of experience on Startups, Government, big tech industry & consulting.

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

Can I add key to <> syntax?

No, use React.Fragment explicitly to add key.

When do I need fragments?

When returning multiple root elements without wrapper div. In lists, only fragments can have keys.

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