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

195
Views
How to add an id to react-select?

I need to know when I click on a react-select component. So I thought by giving it an id and then handle it with window.addEventListener. Based on their official guide, it seems that I have simply to pass id as its prop but it doesn't work.

I have this code:

<Select
  defaultValue={defaultValue}
  options={options}
  styles={selectStyle()}
  onFocus={onFocus}
  onChange={onChange}
  placeholder={placeholder}
  value={value}
  inputProps={{ id: labelId }}
  id="123"
/>

Then I found this answer here, but id doesn't work.

So I tried passing idName and inputProps={{ id: 'fieldId' }} but nothing happens. I check the select id by inspecting with chrome tools and by logging it. It simply doesn't have one. Is there a way to pass an id to the component or another way to check whether I click on the select or outside?

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!