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

241
Views
Tabla de datos de reacción Carga diferida o carga de paginación

Estoy usando react-data-table-component, los datos se obtendrán de una API (que tiene más de 10k registros).

 async function getAllData() { let nextUrl = "/url/"; let temp = []; let config = { headers: { Authorization: `token`, }, }; while (nextUrl !== null) { const response = await apiInstance.get(nextUrl, config); nextUrl = response.data.next; temp.push(...response.data.results); } return temp; } async function tempFunc() { let temp1 = await getAllData(); setDataFromAPI(temp1); // useState } tempFunc();

// Tabla de datos

 <DataTable pagination columns={columns} data={dataFromAPI} customStyles={customStyles} />

En este momento, esta función funciona bien, el problema es que la API tiene más de 10k registros, la página se carga hasta que finaliza el ciclo while.

En lugar de esto, quería cargar solo los primeros 30 o 50 y luego, en la siguiente paginación, me gustaría cargar la siguiente respuesta.

¿Cómo se puede hacer esto?

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!