-2

I thought a data array(result.data.documents) would be logged, but the entire promise was logged.

I meant for it to RETURN only the data part....

What is the mistake? and how can I solve it?enter image description here

<Service.js>

  export const Service = async (value) => {
    const result = await axios.get(`https://dapi.kakao.com/v3/search/book?`,{
      params:{
        target: 'title',
        query: `${value}`,
        size : 5,
      },
      headers: {
        Authorization: `KakaoAK ${API_KEY}`
      }})
   return result.data.documents
  }

<App.js>

const App = () => {
  const value = 'English'
  console.log(Service(value));
}
Ingyu Yu
  • 7
  • 2

0 Answers0