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

293
Vistas
React-Select: Setting selected option when state changes from outside source (not by selecting a new option)

Hi all so basically I am using the react-select library to help streamline some select components I am using in my app. I am using state to keep track of the changes between the values. I am taking this value as well as others and submitting a form to firebase. The issue I am having is when I attempt to load and edit the data. I am currently loading in the field data from firebase and setting the current state to so that the form components display the values from firebase and can be edited. When doing this the data load into the text fields just fine, but the select component does not. I can see the value being passed but the select component doesn't recognize that value should be loaded as the currently selected option. Has anyone had a similar issue?

  const [make, setMake] = useState("");
  const carMakeOptions = [value: "ford", label: "Ford"
                          value: "toyota", label: "Toyota" ...........]
                                                      

 <Select defaultValue={make} defaultInputValue={make} options={carMakeOptions} onChange={(e) => {setMake(e.value)}}> 

Loading in data from firebase and resetting state here:

  setMake(carDocSnap.data().make);
about 4 years ago · Juan Pablo Isaza
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