Home > Categories > React > React Query Crash Course

Home > React Query Crash Course

React Query Crash Course

Updated:

12 Feb 2021

Published:

10 Feb 2021

Caching server state is very hard. And for long time we relied on Redux to manage server state with react app.

But it is not only overkill for managing server state but also unnecessary. With launch of react hook and context provider you can manage global state with vanilla react without using any 3rd party library like redux.

But a better solution is library like react query or SWR. These packages specialize managing server state.

And in this article we are going to learn about React query.

To read rest of the article please Purchase Subscription

View Source code on Github

Before we get started I would recommend to develop React/NextJS project inside development docker container.

So we no longer have the issue of "this works on my computer" 💻. And it will not mess with your existing workflow.

So checkout my blog post for detailed video 🎞️ explanation. Then checkout NextJS/React development container settings on github.

Basics of React Query

Pro Tip: Enable Subtitle

View Source code on Github

Initial Data

Pro Tip: Enable Subtitle

View Source code on Github

Cancel Request/Query

Pro Tip: Enable Subtitle

View Source code on Github

Simple Mutation

Pro Tip: Enable Subtitle

View Source code on Github

Optimistic Updates

Pro Tip: Enable Subtitle

View Source code on Github

Free users cannot comment below so if you have questions then tweet me @apoorvmote. I would really like to hear your brutally honest feedback.

If you like this article please consider purchasing paid