0

When I run npm run build for a Next.js (React & Ts) I get the following error:

Error: Missing "key" prop for element in array react/jsx-key

This error points to the following code:

<GridActionsCellItem
  icon={<SaveIcon />}
  label="Save"
  sx={{
    color: "primary.main",
  }}
  onClick={handleSaveClick(id)}
/>

1 Answer 1

1

Add key property to component. Something like this:

    <GridActionsCellItem
      key={id}
      icon={<SaveIcon />}
      label="Save"
      sx={{
        color: "primary.main",
      }}
      onClick={handleSaveClick(id)}
    />

you can get more info here: https://react.dev/learn/rendering-lists#keeping-list-items-in-order-with-key

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.