fetch data

i want to fetch a specific resource . I used useMany but it is required to add ids and I do not want to add ids i want to fetch all records for the record
3 Replies
kapa.ai
kapa.ai2y ago
Hi @saji_nael. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
kapa.ai
kapa.ai2y ago
---------------------- If you want to fetch all records for a specific resource without providing any IDs, you should use the useList hook instead of useMany. The useList hook is designed to fetch multiple records from a resource without the need for specifying IDs. Here's an example of how to use the useList hook:
import { useList } from "@refinedev/core";

const { data } = useList({ resource: "categories" });
import { useList } from "@refinedev/core";

const { data } = useList({ resource: "categories" });
For more information on the useList hook, you can refer to the refine documentation: https://refine.dev/docs/api-reference/core/hooks/data/useList (https://refine.dev/docs/api-reference/core/hooks/data/useList) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
useList | refine
useList is an extended version of TanStack Query's useQuery. It supports all the features of useQuery and adds some extra features.
kapa.ai
kapa.ai2y ago
<@1000087684632547538> kapa.ai is still learning and improving, please let us how it did by reacting below