Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

265
Views
En Firebase v9, ¿cómo puedo filtrar los elementos de la lista de ropa por título de categoría o por defecto a todos?

Estoy trabajando en una aplicación y estoy tratando de permitir que un usuario filtre elementos según los títulos de una categoría o vea todo. Con este código, puedo obtener todos los elementos que ha agregado un usuario determinado, pero también me gustaría poder filtrar por categoría y mostrar todos los elementos si no se selecciona ninguna categoría.

 export const ClothingListItems = ({ category }) => { const [items, setItems] = useState([]); const userUid = auth.currentUser.uid; const [isLoading, setIsLoading] = useState(false); const [isError, setIsError] = useState(false); //getting items where closetceator Uid == userUid const getClosetAsync = async ({category}) => { setIsLoading(true); try { const q = query( collection(db, "clothing"), where("closetOwerUid", "==", userUid) ); onSnapshot(q, (snapshot) => { let results = []; snapshot.forEach((doc) => { results.push({ ...doc.data(), id: doc.id }); }); setItems(results); setIsLoading(false); }); } catch (error) { setIsError(error.message); } }; // Keep track with changes in data add or delete. Clean up! useEffect(() => { const unsubscribe = getClosetAsync(); return () => unsubscribe; }, []); return isLoading ? ( <LoadingIndicator /> ) : isError || !items.length ? ( <> <Error /> <EmptyView message="Your closet is empty, add items." marginSize={65} /> </> ) : ( <View style={styles.container}> <> <FlatList data={items} keyExtractor={(item) => item.id} numColumns={2} renderItem={({ item }) => <ClothingItem items={item} />} /> </> </View> ); };

base de datos

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!