Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

101
Vistas
rerender React JS

So i m trying to rerender a list by filtered values. The list is already rendered with all the values. I want to render it again with a dropdown of options. I get my values from a JSON locally.

[ { "brand": "toyota", "model": "corona", "cylinders": 4, "horsepower": 96, "origin": "Japan", "price": 40000 }, ... ]


export const FilterBrand = (props) => {
  const brands = props.list
    .map((vehicle) => vehicle.brand)
    .filter((value, index, vehicle) => vehicle.indexOf(value) === index);

  const handleChange = (e) => {
    // console.log(e.target.value);
  };
  return (
    <select onChange={(e) => props.handleChange(e.target.value)}>
      {brands.map((vehicle, key) => (
        <option key={key} value={key}>
          {vehicle}
        </option>
      ))}
    </select>
  );
}; here is my component



<div className="filter-brand">
 <FilterBrand
 list={list}
 handleChange={(value) => console.log(value)}
 />
</div here is my component imported in main app, JSON is also imported in main app and passed as props in my component.
How can I render it again based on the options from the dropdown?
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

use a state to store the 'results' to show then use a function or two to change 'results' based on the 'filter' selected. When a change in state occurs react will automatically re-render the view for you

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda