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

157
Views
error de función de filtro :: Error no detectado: los objetos no son válidos como un niño React ... use una matriz en su lugar

Intentando mostrar los resultados después de aplicar la función de filtro. Necesito comparar con searchValue. Pero da error

 {noteList.filter((obj,index) => <Card 
 noteObj={obj.Name.toLowerCase().includes(searchValue)} 
 index={index} 
 deleteNote={deleteNote}
 updateNoteArray={updateNoteArray}
 />)
} 
almost 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Primero debe filtrar las opciones de la matriz noteList de acuerdo con su condición y luego aplicar un map sobre ella.

 {
noteList.filter((obj) => obj.Name.toLowerCase().includes(searchValue))
 .map((item,index) => <Card 
 noteObj={item} 
 index={index} 
 deleteNote={deleteNote}
 updateNoteArray={updateNoteArray}
 />
 )
}

noteList.filter((obj)=>obj.Name.toLowerCase().includes(searchValue)) Esto devolverá una nueva matriz que contiene todos los nombres que incluirán searchValue . Luego puede usar esta matriz resultante para mostrar su resultado

almost 4 years ago · Santiago Trujillo Report

0

usar map no filter

 { noteList
.filter((obj, index)=>{ return obj.Name.toLowerCase().includes(searchValue)})
.map((obj,index) => <Card 
 noteObj={obj} 
 index={index} 
 deleteNote={deleteNote}
 updateNoteArray={updateNoteArray}
 />)
}
almost 4 years ago · Santiago Trujillo Report
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!