Generating random integer & only displaying it to the app user if it isn't already stored on Firebase

Hi all,

I would really appreciate instructions on how I can achieve this.

The goal is to:

1) Generate a random 6 digit integer and display it to the app user provided it is not already stored in a specific firebase collection. (i.e generating a unique code).

2) Once displayed to the user, the code is then stored within that same firebase collection.

So far using AI, I have been able to generate the random 6 digit integer and store it in a page state variable... but now I am stuck.

Thank you!

2
12 replies