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
More Related Contents:
- How to add function in JSX?
- Loop inside React JSX
- Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function but got: object
- Why shouldn’t JSX props use arrow functions or bind?
- Render HTML string as real HTML in a React component
- React – User-Defined JSX Components Not rendering
- Applying className/onClick/onChange not working on Custom React Component
- How to use componentWillMount() in React Hooks?
- ReactJS – .JS vs .JSX
- How to render HTML string as real HTML?
- React.js: Identifying different inputs with one onChange handler
- ESLint with React gives `no-unused-vars` errors
- Passing props into external stylesheet in React Native?
- What do curly braces mean in JSX (React)?
- How to Call a Function inside a Render in React/Jsx
- How to have nested loops with map in JSX?
- Using styled-components with props and TypeScript
- How to avoid bind or inline arrow functions inside render method
- Why is immutability so important (or needed) in JavaScript?
- react.js Replace img src onerror
- I can’t reference an image in Next.js
- Is there a way to render multiple React components in the React.render() function?
- Do we still need functional setState way in react hooks?
- React 18 strict mode causing component to render twice [duplicate]
- Reactjs-setState previous state is the first argument, props as the second argument
- stop dragging after a limit has reached
- Equivalent to componentDidUpdate using React hooks
- reactjs event listener beforeunload added but not removed
- React – Dynamically Import Components
- FastAPI is not returning cookies to React frontend