目標(biāo):渲染我的 firestore中具有status: false這是我的文檔結(jié)構(gòu):Status: falseArtist: Pablo PicassoMedium: Oil Painting這是循環(huán)遍歷 firestore 中數(shù)據(jù)的代碼......function Feed() { const [artworks, setArtworks] = useState([]); useEffect(() => { db.collection("artworks").onSnapshot((snapshot) => setArtworks(snapshot.docs.map((doc) => doc.data())) ); }, []); return ( <div className="feed"> <div className="artwork__feed"> {artworks.map((artwork) => ( <FeedCard artist={artwork.artist} medium={artwork.medium} /> ))} </div> </div> );}關(guān)于如何遍歷 firebase 并只呈現(xiàn)具有的數(shù)據(jù)的任何想法status: false?
有條件地在組件中渲染 firebase 數(shù)據(jù)
慕碼人2483693
2023-03-24 15:17:58