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
Multiple select component doesn't return updated selected values onChange

React (and JS ad web-development) newbie here.

I'm using react-select to build a filter box on the sidebar of a web map. The goal is that when I apply several filters (there's a checkbox and two multiple selection dropdown menus at the moment) the data on the map get updated accordingly.

The problem is that when I get the selected value through onChange, it seems I get the old options.

Example: a, b, c selected on the dropdown, I get a, b in the console.log.

So my filter function cannot use updated values.

If I use the DOM (through document.getElementsByName), I receive a NodeList which is off-by-one when I try to convert to an array (it loses the last selected option somehow...); If I use the event on handleChange, I don't get a representation of the event but just the values (this is problematic because I have several filters and each triggers the handleChange so I need to know which menu triggered the event).

I know I've not been crystal clear, but any hint would be appreciated since I'm really stuck. Thanks a lot.

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!