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

209
Vistas
react-select debounce after entered minimum character length

I'm using react-select to get search names from backend service.Therefore I need to add debounce for my search field and API need to call after minimum character length (3) entered in the text field.

I tried as bellow.but its won't showing the results in dropdown.

 <AsyncSelect
        defaultOptions
        isClearable={true}
        className="form-control"
        id="search"
        loadOptions={(data) => {
            data.length >= 3 && loadOptions();
            }}
        onChange={handleChange}
    />
    
     const loadOptions = _.debounce((data, callback) => {
        fetchData(data).then((options) => {
          callback(options);
        });
      }, DEBOUNCE_TIME);

      
  const fetchData = async (data) => {
     if (data) {
       const nameList = await request(METHOD.GET, `${API_URL.GET_BY_NAME}/${data}`);
        if (nameList.data) {
            return nameList.data.map((v) => ({ value: v.name, label: v.name }));
        }
     }
  };
about 4 years ago · Santiago Trujillo
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