Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda