I'm trying to exports the results of my Airtable records into a json file.
I'm using a react-js env in codesandboxio.
I coded a function that retrieve all the records, but i can only console.log their value.
function loadGeneralItems(table) {
var recList = []
base(table).select().all()
.then(
function (records) {
for (let i=0; i< records.length; i++)
recList.push(records[i]._rawJson.fields)
// console.log(recList) // outputs ([Object, ...])
});
// return recList // returns nothing
}
I would like to return recList and parse it as a json object.