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
- Using <> shorthand fragment in list (can't add key)
- Key on parent instead of fragment itself
- Not understanding when to use fragments
- Mixing fragment and non-fragment items
- 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.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get Help