React Native firebase email verification user.user.sendEmailVerification is not a function

Viewed 30

i'm trying to create an app using firebase. here my code:

const user = await createUserWithEmailAndPassword(auth, email, password)
await user.user.sendEmailVerification()

user is initializing in firebase authentication but this is happening :

TypeError: user.user.sendEmailVerification is not a function.
1 Answers

You can use async-await syntax with try-catch this way :

try {
  const { user } = await auth().createUserWithEmailAndPassword(email, password);
  await user.sendEmailVerification();
  return user;
} catch(e) {
  return e;
}

Related