JSFiddle - React, Tailwind, and code Playground

by fergmux

JavaScript

let x = [
{
	pet: 1
  data: {
  	name:
  }
},
{
	pet: 2
}
]

const uuid = () => Math.random()

const updatePets = data => x.map(item => 
  ({...item, uuid: data })
)

x = updatePets(uuid())

console.log(x)