diff --git a/Chapter15/src/components/Carlist.tsx b/Chapter15/src/components/Carlist.tsx index 85bd2ce..8e5f4ad 100644 --- a/Chapter15/src/components/Carlist.tsx +++ b/Chapter15/src/components/Carlist.tsx @@ -13,8 +13,8 @@ function Carlist() { const queryClient = useQueryClient(); - const { data, isError, isLoading } = useQuery({ - queryKey: ["cars"], + const { data, isError, isLoading, isSuccess } = useQuery({ + queryKey: ["cars"], queryFn: getCars }); @@ -72,7 +72,7 @@ function Carlist() { else if (isError) { return Error when fetching cars... } - else { + else if (isSuccess) { return ( <>