Replies: 3 comments 2 replies
-
Ah, seems like i figured this out. I can just useQuery without queryFn // instead of const selectedInstitutionId = QueryClient.getQueryData(['selectedInstitutionId'])
const { data: selectedInstitutionId} = useQuery({ queryKey: ['selectedInstitutionId']}) this way component rerenders after value being changed with |
Beta Was this translation helpful? Give feedback.
-
However, I found this topic #2852 where it is said that it is better to use other state management libraries i.e. zustand for storing global state. Do I really need to? I am aiming to reduce the amount of libraries I'm using and hope that Tanstack will fetch for me and also store my client state |
Beta Was this translation helpful? Give feedback.
-
What should this custom hook look like? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, can i use tanstack like React context to sync state across components?
For example:
Parent component, which set an initial state
Component, which updates state
Component, which renders GUI, based on state
Can I somehow trigger component to rerender if specific query being changed using
.setQueryData
?Or tanstack is not a tool I need for this case?
Beta Was this translation helpful? Give feedback.
All reactions