const [userDetails, setUserDetails] = useState();
const { user } = useContext(AuthContext);
useEffect(() => {
firebase
.firestore()
.collection("users")
.get()
.then((res) => {
res.forEach((doc) => {
setUserDetails(doc.data());
});
});
}, []);
This is my code when I add .where("id", "==", user.id) extra code is not working
const { user } = useContext(AuthContext);
useEffect(() => {
firebase
.firestore()
.collection("users")
.where("id", "==", user.id)
.get()
.then((res) => {
res.forEach((doc) => {
setUserDetails(doc.data());
});
});
}, []);
anybody can tell me whats the problam is?