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

145
Vistas
ReactJS: make a select that load all values from api

I'm creating a select (at the moment i'm using React-Select component) to retrive all the result from the api.

The problem is that API gives me back 20 values, so I should find a method to load other 20 values ( as I make another api call )

const option = personList && personList .map((spl) => {
    return {
      value: spl.perCod,
      label: spl.perName
    }
  })

          <Row>
            <Col>
              <Select
                id="perCod"
                name="perCod"
                options={option}
              />
            </Col>
          </Row>

the personList is populated calling the api:

  useEffect(() => {
    sortEntities();
  }, [paginationState.activePage, paginationState.order, paginationState.sort]);

const sortEntities = = () => {
//...
 props.getFilteredEntities(
        search, // i pass there the parameters for the research
        paginationState.activePage - 1,
        paginationState.itemsPerPage,
        `${paginationState.sort},${paginationState.order}`
      ),
}

props.getFilteredEntities in my reducer is:

export const getFilteredEntities: ICrudSearchAction<Person> = (search, page, size, sort) => {
  const params = new URLSearchParams(search) ? new URLSearchParams(search).toString() : null;
  const requestUrl = `${apiUrl}${sort ? `?page=${page}&size=${size}&sort=${sort}` : ''}${sort ? '&' : '?'}${params}`;
  return {
    type: ACTION_TYPES.FETCH_PERSON_LIST,
    payload: axios.get<Person>(`${requestUrl}${sort ? '&' : '?'}cacheBuster=${new Date().getTime()}`),
  };
};

At the moment my select has the first 20 results from api. I should need to load others. How can I do? thank you.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

change your <Select> code with this, you have to add option tag within iteration, to render all options within select tag,

<Select id="perCod" name="perCod">
  {option.map(o=><option key={Math.random()} value={o.perCod} >{o.perName}</option>)} 
</Select>
about 4 years ago · Juan Pablo Isaza Denunciar
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