Update/set nested data #1500
Replies: 1 comment
-
my mental model of the query cache is that it's just a good old javascript object, where the keys are the serialized version of your query-keys and the data is whatever you put in there. with
if you have a separate component that does |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
Assuming I have
todos
cache with following structure:How can I get a single
todo
fromdata
usinggetQueryData
, and how to update it usingsetQueryData
without querying/updating the wholetodos
cache?I mean, I can do the following:
queryClient.getQueryData("todos")
and work with returned data, but I wonder if there is a way to get a single item like described here: https://react-query.tanstack.com/guides/query-keys. I triedqueryClient.getQueryData(["todos", "data"])
,queryClient.getQueryData("todos.data")
, but I getundefined
.Beta Was this translation helpful? Give feedback.
All reactions