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

137
Vistas
How to take JSON information and give it to a React component?

The fetch request (from Google Sheets) returns stats, which is an array of arrays. In stats is a list of teams with their wins and losses (one of them looks like this ['Cannons', '4', '2'], like you see in teams. I want stats to automatically fill in my teams array or give it to the data prop in Table. Thank you for your help!

const getSheetValues = async () => {
    const request = await fetch(`https://sheets.googleapis.com/v4/spreadsheets/${SHEET_ID}/values/A1:C7`,
    {
        headers: {
            "Content-Type": "application/json",
            Authorization: `Bearer ${ACCESS_TOKEN}`
        }
    });
    const stats = await request.json();
    console.log(stats);
    return stats;
}

const teams = [
    {
        team: 'Cannons',
        wins: 4,
        loss: 2
    },
    {
        team: 'Rhythm',
        wins: 1,
        loss: 5
    }
]


const Standings = () => {
    return (
        <div className='cont'>
            <div className='standings'>
                <Table columns={columns} data={teams} className='tbl' />
            </div>
        </div>
    )
}
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