I have tried fetching data from airtable API using airtable.js
here is the code that airtable gives
var Airtable = require('airtable');
var base = new Airtable({apiKey: 'YOUR_API_KEY'}).base('app1lRj8mFkG7qy4p');
base('All Impact Organisations').find('rec3JjliAZkNmbFVX', function(err, record) {
if (err) { console.error(err); return; }
console.log('Retrieved', record.id);
});
and what i want is
var Airtable = require('airtable');
var base = new Airtable({apiKey: 'YOUR_API_KEY'}).base('app1lRj8mFkG7qy4p');
const result = base('All Impact Organisations').find('rec3JjliAZkNmbFVX', function(err, record) {
if (err) { console.error(err); return; }
else return record
});
console.log(result)
I know that is wrong code because airtable use a callback function to fetch the data, however, why I want to do that because I need to concat the result data with another record
FYI I'm using react in this problem
can somebody help me?