Can I add a key prop to a React fragment?

To add a key to a fragment you need to use full Fragment syntax:

<React.Fragment key={your key}>
...
</React.Fragment>

See docs here https://reactjs.org/docs/fragments.html#keyed-fragments


You can also use this way to auto assign key to your component list

React.Children.toArray(someData.map(data=><div>{data.name}</div>))