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

97
Views
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 answers
Answer question

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 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!