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>
)
}