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

131
Views
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
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!