how add key for fragment
See original GitHub issuebefore i use
<Fragment key={index}>
now i use
<>
how add key this ?
< key={index}> has error
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Can I add a key prop to a React fragment? - Stack Overflow
Yes, you can add a key in the below form Fragment which is not possible in the shorter version of Fragments ...
Read more >Keyed Fragments - React
In most cases, you can use the key prop to specify keys on the elements you're returning from render . However, this breaks...
Read more >How to add a key prop to a React Fragment | bobbyhadz
Use the more verbose syntax of fragments to add a key prop to a React fragment, e.g. <React.Fragment key={key}> . The more verbose...
Read more >React Fragments in Practice – 4 real-world examples
Learn how to use React Fragments let to group React elements, without requiring unnecessary markup or confusing key props.
Read more >React Fragments - Uses, Examples, Practices - KnowledgeHut
Yes, React. Fragments can have a key, but the shorter syntactic sugar form of React Fragment does not support keys and attributes. Tags....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@uxitten Syntax works only for propless fragments. If you need to add key, just use
React.Fragment. There’s nothing wrong with it.Isn’t this clean enough? https://reactjs.org/docs/fragments.html
