0

I am creating a React App where a user has to sign up to access to the dashboard. For this i need a code to create a unique username for every user. Please someone help me out to do so...

Here is my code:

const q2 = query(
      collection(db, "users"),
      where("email", "==", email2)
    );
    if (q2) {
      setErr8(true)
      setTimeout(() => {
        setErr8(false);
      }, 2000);
      return
    }
    setLoading(true)
    try {
      //Create user
      
      const res = await createUserWithEmailAndPassword(auth, email, password, confirmpassword);
    } catch (err) {
      setMainErr2(true);
      setLoading(false);
    }
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

0 Answers0