Can anyone help me on this react issue ,please?

Please let me know why this function throws me “unique key prop Error”.


// react-jsx-dev-runtime.development.js:87 Warning: Each child in a list should have a unique “key” prop.

// Check the render method of Hello. See for more information.
// at Hello
// at App

import React from 'react'
import data from './data'
const Hello = () => {
    return (
       => {
                    return (<>
                        <div key={}>  

export default Hello

Add a console.log( between these two lines to see what the ids look like.

Instead of using <>....</> you can use <React.Fragment>...</React.Fragment>
You have add key param to div after fragment so you have to remove it from there and assign it to the fragment directly. eg. <React.Fragment key={}>

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.