Skip to content

What is the queryOptions in the useSelect() used for? #1656

Answered by omeraplak
BenGardiner123 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @BenGardiner123 ,
Thank you for contact with us. Refine uses react query to manage state management.

You can use React Query's options with queryOptions.

For example,
If you want to make useSelect wait until a condition is met,

     const { selectProps: categorySelectProps } = useSelect({
         resource: "categories",
         queryOptions: {
             enabled: someCondition
         }
     });

or if you want to use polling,

     const { selectProps: categorySelectProps } = useSelect({
         resource: "categories",
         queryOptions: {
             refetchInterval: 1000,
         }
     });

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by omeraplak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants