79191295

Date: 2024-11-15 06:35:14
Score: 0.5
Natty:
Report link

Update the addItem to below given function.

const addItem = () => {
const newItem = { id: (data.length + 1).toString(), name: `Item ${data.length + 1}` };
setData([...data, ...newItem]);
};
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Harsh Kukarwadiya