skip to Main Content

Javascript – How do I fix this error: Query data cannot be undefined. Please make sure to return a value other than undefined from your query function

I have the following code. import Post from "../post/Post"; import "./posts.scss"; import {useQuery} from "@tanstack/react-query"; import {makeRequest} from "../../axios"; //omitted code here const {isLoading, error, data } = useQuery({ queryKey: ["posts"], queryFn: () => { makeRequest.get("/posts").then((res) => { return res.data;…

VIEW QUESTION
Back To Top
Search