Replies: 4 comments 1 reply
-
A websocket message can be thought of as the result of a mutation, so the same APIs here should be used. https://react-query.tanstack.com/guides/updates-from-mutation-responses |
Beta Was this translation helpful? Give feedback.
-
Ok nice exactly like Redux I am reassured. I have learned all the Redux in the market currently (thunk, saga, observable) but I don't see the point of To me this is natural every developer knows the main state of a request Another question how can I catch the http request code response in case of error, I wanna know if this is a code 404 or 403. How can I save that beside the error message. Have a look how I am doing this for clients https://github.com/tomtom94/react-easy-ssr/blob/master/src/store/reducers/index.ts#L39 Would you like to convince me ? or you don't care at all and you understand my point of view. Just need to know. |
Beta Was this translation helpful? Give feedback.
-
React Query has nothing to do with Redux, so I'm not sure why this is relevant here.
If you have read the documentation, watched the videos, tried it out, etc and still don’t see the use case or benefit then unfortunately there’s little left for me to do to help you understand or convince yourself. No one is pressuring you to use it.
The state representation for declarative data fetching, stale-while-revalidate and background data fetching is no cakewalk. Conflating the concept to 2 booleans is exactly why Redux data fetching has been stuck in a rut for years.
Framework? Nope. But if your application is meant to (at the very least) "appear" to be in sync with your server-side data, then you absolutely need something to standardize those contracts. Of course, you can always attempt to manually replicate all of the functionality of React Query in your own custom Redux setup. I spent 3 years doing just that and didn't really make a dent in the problem space, but if that's what it's going to take to convince yourself, then I say go for it. Your learning experience will be priceless. Or, for the sake of time, you could perhaps entertain the thought that many others have also “learned all the Redux the market” and gone on to create better tools that can save you from further hassle. I've never seen any tool in the Redux ecosystem come close to the UX/DX, features, and efficiency of React Query. Even RTK-Query (at the time of writing) is extremely nascent with a long road ahead.
It appears from this comment that you still didn't bother to read the docs. I could be mistaken, so you can read about throwing errors in your query functions here
Sure, but I haven't the time.
Untrue. I try to treat everyone's questions with a minimum amount of respect and care, as long as they do the same for me.
I understand that it can be difficult to learn new data fetching concepts if you've been entrenched in the Redux ecosystem for too long. |
Beta Was this translation helpful? Give feedback.
-
Yes sure, I read the doc very quickly, but it is said I also notice you allow the server side rendering via Next.js with the method Your module is really great. Congrats to you and many thanks for your help. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I noticed you can't access the reducers, middlewares, global state etc... I just noticed you can't access anything ;)
What if I wanna make a live chat with websocket.
I receive a push from the server containing the next message of the conversation,
I wanna add this message to the top of the array messages downloaded previously with your
useQuery
method.How can I do this just give me a link from your doc.
I hope for you this is possible. If not possible, would you give us finally access to the reducers ? exactly like redux does.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions