Skip to content

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

Open
@shekharramola

Description

@shekharramola
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions