I would like to return a single variable on my website that is founded in my API REST. I'm using Axios to integrate my backend to my frontend.
import api from '../../api';
async function handleBooks(e){
e.preventDefault();
const data = {
title,
reservation,
rent,
devolution
};
try{
const response = await api.get('books', data);
console.log(response); //it is working!
}catch(err){
console.log('!response');
}
}
return(
//I would like to return one of those variables upside mentioned, for example: 'title'.
<div>{response.data.title}<div/>
);