I have a useQuery hook which calls an api and returns the response like :
return {
title : response?.data?.[0]?.title,
desc: response?.data?.[0]?.desc,
}
I have the useQuery like this :
const {data: content} = useQuery('entitle', apiCall)
Here, I am trying to destructor this data like :
const {data: {title : [], desc: []}} = useQuery('entitle', apiCall)
Now, it gives can not read property title of undefined while using it . How can I fix this ?