I am learning React but when I register a user(using createUserWithEmailAndPassword) and try to update the displayName property I get the error as "user1.updateProfile is not a function".
How can I solve this error?
My code:
const register = async (e) => {
if (name.length == 0) {
alert("name cannot be empty");
} else {
const userWithEmailAndPassword = await createUserWithEmailAndPassword(auth, email, password)
.then((auth1) => {
const user1 = auth.currentUser;
user1.updateProfile({
displayName: name
});
})
.catch(error => alert(error.message))
console.log(userWithEmailAndPassword);
}
}