useParams로 가져온 값이 firebase 내 콜렉션 안에 있는
데이터 값과 일치 할 경우 해당 데이터를 가져와 사용하고 싶습니다.
where을 사용했고 useParams로 가져온 값을 그대로 입력 했을 때는
해당 데이터 값이 출력 되지만 유동적으로 찾는 방법을 모르겠습니다...
어떤식으로 해결해야 하는지 조언 부탁드립니다.
const uid = useParams();
console.log(uid);
useEffect(() => {
dbService.collection("Users").where("uid", "==", "")
.get()
.then((querySnapshot) => {
querySnapshot.forEach((doc) => {
// doc.data() is never undefined for query doc snapshots
console.log(doc.data());
});
})
.catch((error) => {
console.log("Error getting documents: ", error);
});
}, [])