R
Refine

ask-any-question

hook for list

Eexotic-emerald8/1/2023
is there any hook for getting list of items from a resource rather than useAutocomplete
Kkapa.ai8/1/2023
Hi @alfaz_muhammed. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, refine provides several hooks for fetching lists of items from a resource. 1. useList: This hook is an extended version of TanStack Query's useQuery that supports all of its features and also adds some more. It is used when you need to fetch data according to sort, filter, pagination, etc. from a resource. It uses the getList method as the query function from the dataProvider which is passed to <Refine>. It also uses a query key to cache the data. The query key is generated from the provided properties. You can see the query key by using the TanStack Query devtools. Source (https://refine.dev/docs/api-reference/core/hooks/data/useList) 2. useInfiniteList: This hook is an extended version of TanStack Query's useInfiniteQuery used for retrieving items from a resource with pagination, sort, and filter configurations. It is ideal for lists where the total number of records is unknown and the user loads the next pages with a button. It uses the getList method as the query function from the dataProvider which is passed to <Refine>. It also uses a query key to cache the data. The query key is generated from the provided properties. You can see the query key by using the TanStack Query devtools. Source (https://refine.dev/docs/api-reference/core/hooks/data/useInfiniteList) 3. useSelect: This hook allows you to manage any select component. It uses the useList hook for fetching data. Source (https://refine.dev/docs/api-reference/core/hooks/useSelect/index) 4. useSelect (Ant Design): This hook allows you to manage Ant Design <Select> component when records in a resource need to be used as select options. It uses the useList hook for fetching data. Source (https://refine.dev/docs/api-reference/antd/hooks/field/useSelect) 5. useSelect (Mantine): This hook allows you to manage Mantine <Select> component when records in a resource need to be used as select options. It uses the useList hook for fetching data. Source (https://refine.dev/docs/api-reference/mantine/hooks/useSelect) 6. useAutocomplete (Material UI): This hook allows you to manage Material UI <Autocomplete> component when records in a resource need to be used as select options. It uses the useList hook for fetching data. Source (https://refine.dev/docs/api-reference/mui/hooks/useAutocomplete) Please note that all these hooks use the useList hook for fetching data. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Kkapa.ai8/1/2023
<@763439201353596968> kapa.ai is still learning and improving, please let us know how it did by reacting below

Looking for more? Join the community!

R
Refine

ask-any-question

Join Server