Replies: 1 comment
-
sure, that works |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have an additional follow-up question that is related to this. I'm looking to create a more dynamic component that allows for different custom useQuerys' to be passed into the component, and I'm wondering if that is an ok approach, or is there a better alternative.
Use cases are for things like Async Select components and Infinite lists. Eg. When a user types in an input, there's a debounce, the
useQuery
fires and populates the options. Or, when a user scrolls to the end of an infinite list, theuseInfiniteQuery
hook fires, and loads in more options.For example, the setup I've done that works look something like this, but it doesn't feel right passing hooks down as props, as hooks should not be called conditionally:
One other option is to export the queryParams and pass the queryParams as a prop instead by having a
useQuery(params)
in the Select component itself.Are there other ways to approach this better? I'm trying to avoid bloating the codebase with custom individual components like
UserSelect
,EventSelect
,EtcSelect
that calls the respective hooks in their files. This applies to infinite lists too.Beta Was this translation helpful? Give feedback.
All reactions