I tried to use the new remove() function that is written in the Firebase Realtime Database documentation, but I can't really figure out how to actually remove the data. I get an error saying userRef.remove() is not a function. But I have no idea how to actually use it.
This is the code that gives me that message:
document.getElementById("yes-delete").addEventListener('click', (e) =>{
const userRef= ref(db, 'users/' + user.uid);
userRef.remove();
});
This is the error message I'm getting:
Uncaught TypeError: userRef.remove is not a function at HTMLButtonElement. ((index):209)
This is what they write on Firebase documentation:
Delete data
The simplest way to delete data is to call remove() on a reference to the location of that data.
It was just remove(userRef); My apologies