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

183
Views
React .map () no se actualizará cuando cambie .filter

Tengo una página con una búsqueda, puede filtrar los resultados con un control deslizante de rango. Tengo un evento onChange en el control deslizante que debería establecer dinámicamente un parámetro .filter. Estoy pasando ese parámetro a un .sort().filter(props.filter).map() encadenado.

Cuando uso el control deslizante, está cambiando el parámetro por el que estoy pasando, pero .map() no está actualizando los resultados.

Cualquier ayuda muy apreciada:

 let genderSpecificFilter = 'All'; let rangeSpecificFilter = 'All' let sendFilteredDoctors = () => filterDoctors(genderSpecificFilter,rangeSpecificFilter); function changeRangeFilterParams() { rangeSpecificFilter = checkBoxDistanceMap[document.getElementById('range-miles').value]; sendFilteredDoctors = filterDoctors(genderSpecificFilter,rangeSpecificFilter); console.log(rangeSpecificFilter) }
 <PrintSearchResults doctors={doctors} filters={sendFilteredDoctors} />
 import PrintDoctor from "./printdoctor"; function PrintSearchResults(props) { return ( <div> {props.filters} <p className="text-xl text-gray-350"> Total Results: <span className="ml-3" id="total-results-num"> {props.doctors.results .sort((a, b) => a.locations[0].distance - b.locations[0].distance) .filter(props.filters).length} </span> </p> {props.doctors.results .sort((a, b) => a.locations[0].distance - b.locations[0].distance) .filter(props.filters) .map((doctor, key) => ( <PrintDoctor image={doctor.image} url={doctor.url} fullName={doctor.fullName} specialties={doctor.specialties} locations={doctor.locations} gender={doctor.gender} key={key} /> ))} </div> ); } export default PrintSearchResults

Editar: en el cambio que viene de aquí:

 <input onChange={changeRangeFilterParams} type="range" min="1" max="6" className="slider" defaultValue="6" id="range-miles" />
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!