I’m trying to delete each document by id but the code is not working as expected.
const DeleteDocById = async(id)=>{
try {
await deleteDoc(doc(db, "Charities", id))
console.log('deleted....')
} catch (error) {
console.log('Not deleted....')
}
}
function ListItemDelet (item) {
return (
<View>
<TouchableOpacity onPress={()=>handleDelete(item)}>
<Image
source={icons.delete_1}
resizeMode='contain'
/>
</TouchableOpacity>
</View>
)
}
So, when I click the icon delete the document is not removed and it prints the message in catch console log Not deleted. please help me how to delete each document separately by the ID