react-apollo-hooks icon indicating copy to clipboard operation
react-apollo-hooks copied to clipboard

UseQuery is not calling any API in the network side, when I console.log response, I am seeing this. what could be wrong here?

Open shekharramola opened this issue 2 years ago • 0 comments

import axios from "axios";

export const apiClient = axios.create({
  baseURL: "myBaseUrl"
});


const getData = async (id: string) => {
  console.log(' I am not getting called WHY')
  const response = await apiClient.get<any>(`api/${id}`);
  return response.data;
};

const useGetData = (id: string) => {
// console is also coming till here
  return useQuery(['myApiEndPoint', id], () => getData(id));
};


// inside component
 const response = useGetData(id);
  console.log({response})
image image

shekharramola avatar Feb 02 '23 12:02 shekharramola