React - queryClient.getQueryData(key) - can I think about it as about useContext?
I have a situation where I fetch data in
- props drilling - sounds bad as usual props drilling
- context - there are performance issues with the context without using useContextSelector and it's not compliant for some reason.
- queryClient.getQueryData as a mechanism to retrieve in the bottom of the tree or throw when undefined.
Considering only scenario 3:
1) Is it correct to assume data will be always defined when fetched?\
2) Does it break somehow react-query paradigms?
<ParentComponent /> using useQuery hook. I have a lot of nested children in this component and I need to display the data on the bottom of the tree and I consider following options:- props drilling - sounds bad as usual props drilling
- context - there are performance issues with the context without using useContextSelector and it's not compliant for some reason.
- queryClient.getQueryData as a mechanism to retrieve in the bottom of the tree or throw when undefined.
Considering only scenario 3:
1) Is it correct to assume data will be always defined when fetched?\
2) Does it break somehow react-query paradigms?