I am trying to make an api call using fetch. But i am getting a promise in that not the data.If i resolve the promise inside fetch, i get the data not outside. How can i get the result from api to data variable.
export function getAllBooks() {
var data= fetch('https://api.myjson.com/bins/9paef').then((data) => {
data.json().then(function (response) {
return response
});
})
console.log("data",data)
}