How would you fetch a single element using its key with TanStack DB? #1145
Replies: 1 comment
-
|
To get a single item from a collection:
But I think you are asking how to fetch only one item from your API using a queryCollection. To do that, you can use an |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I went through the documentation and I haven't found a way to fetch a single element without calling the list endpoint of my query collection. Essentially, I would like to have
peopleandpeople/:idwhere:idwould be my collection item key. Is there a pattern for that anywhere? Should I simply create a fetch function and then do a direct write to the cache?Thank you for your time and consideration.
Beta Was this translation helpful? Give feedback.
All reactions