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

95
Views
Llamar api en la carga de la página en React

Estoy aprendiendo React y estoy tratando de llamar a una API en la carga de mi página, pero hasta ahora no he tenido mucho éxito. Estoy tratando de llamar a una API que extraerá un JSON que se usa para llenar mi cuadrícula. Aquí está mi código:

 import React, { Component, useCallback, useState, useEffect } from "react"; import axios from 'axios'; import './styles.css'; import '@progress/kendo-theme-default/dist/all.css'; import { Grid, GridColumn, GridToolbar } from "@progress/kendo-react-grid"; import { DropDownList } from "@progress/kendo-react-dropdowns"; import { GridPDFExport } from "@progress/kendo-react-pdf"; import { ExcelExport } from "@progress/kendo-react-excel-export"; export function GridTable1({}) { const [ grid1, setGrid1 ] = useState(); const fillTable= async () => { await axios .get('http://11.11.21.111:8888/api/v1/CheckTablespace') .then((res) => { setGrid1(res.rlista) }); console.log('Log this'); } useEffect(() => { fillTable(); }, []) return ( ... ... ); }

El registro de la consola no está registrado, así que no sé qué hacer. La ayuda sería muy apreciada

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

¡¡¡Prueba esto!!!

 export function GridTable1() { const [ grid1, setGrid1 ] = useState(); useEffect(() => { axios .get('http://11.11.21.111:8888/api/v1/CheckTablespace') .then((res) => { setGrid1(res.rlista) }); console.log('Log this'); }, []); return ( {grid1 && <div> ...your HTML </div>} ); }
about 4 years ago · Juan Pablo Isaza Report
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!