'Getting user ids with react native and firestore

I tried to list the ids of the users under the users folder in the firebase firestore but it didn't work, can you help?

   const [users, setUsers] = useState([]);       

   const getList = () => {
    const subscriber = firestore()
      .collection('users')
      .doc()
      .get()
      .then(result => {
        setUsers(result.data());
      });
      

      console.log(users)

    return () => subscriber();
  }
    
    useEffect(() => {
    
        setisLoading(true)
        getList()
        setisLoading(false)
    
      }, []);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source