Check out example codes for "get all data documents from firestore". It will help you in understanding the concepts better.

Code Example 1

const [userssDetails, setUserssDetails] = useState([])
    useEffect(()=>{
        //load hospitals into hospitalsList
        const users = []
        db.collection('users').get()
            .then(snapshot => {
                snapshot.docs.forEach(user => {
                    //add data to appObject with id and push them into users
                    let currentID = user.id
                    let appObj = { ...user.data(), ['id']: currentID }
                    users.push(appObj)
					//add data to users without the id from DB
                    users.push(user.data())
            })
           //save users to hospitalsDetails
            setUserssDetails(users)
        })
    },[])

Code Example 2

//retrieve one document and save it to userDetails
const [userDetails, setUserDetails] = useState('')
db.collection('users').doc(id).get()
        .then(snapshot => setUserDetails(snapshot.data()))

Learn ReactJs, React Native from akashmittal.com