let get_query_snapshots = async (coll) => {
let query_snapshots = await get_docs(coll)
query_snapshots->QuerySnapshot.size->Js.log
}
let _ = get_query_snapshots(collection_ref)
and I get the number of docs in the collection.
Is it the right way to do it or is there a way to call the async function immediately after declaring it (like an IIFE in JS)?
It works the same as in JS, so you can do an IIFE just like there, only that you need to take care of the return value in ReScript. So, in the case of an async function, you’ll need to either ignore the promise returned by the function, or assign it to _ like you’re already doing in your example.