What should I type in XXX if I want to check if there are any object in imagesWithChangedName with id which is same as the image ID?
const [imagesWithChangedName,setImagesWithChangedName] = useState([])
const handlePhotoNameChange = (e, imageID) =>{
e.preventDefault()
if(imageID && e.target.value){
if(XXX === imageID)
setImagesWithChangedName([...imagesWithChangedName,{id:imageID, changedName: (e.target.value) }])
}
}
}
Edit: Also, How to replace the value of changedName value of with new value if XXX === imageID is equal to true?