A lighter alternative to Redux: React Query

https://react-query.tanstack.com/

What is React Query

Server State vs. Client State

How can it replace Redux?

Queries

  • used forGET and POST methods, to retrieve data
  • React Query provides the useQuery hook that takes a unique key and a function that returns a promise
  • after storing data in cache with useQuery, you can access that data at any point with useQuery, which takes the unique key as an argument: const data = useQuery(‘unique key’)

Mutations

  • used for PATCH/PUT and DELETE methods, to modify data
  • React Query provides the useMutation hook

--

--

--

full-stack developer exploring how software can solve real-world problems | https://sarabastian.com/

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What tools & tech are devops engineers using today

You’ve Likely Done This in the past, and It’s Not Your Fault, We Can’t Avoid It

(Very) Basic Concept of Git

Crio’s Winter of Doing 2021 — Stage 1 (Warm-Up)

Flash Stock Rom on Kata I5

11111

Restream Team please fix #linkedinlive issues

Create a Customer Service Messenger Bot with wit.ai and the Facebook Marketing API

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sara Bastian

Sara Bastian

full-stack developer exploring how software can solve real-world problems | https://sarabastian.com/

More from Medium

What is React Fiber and How It Helps You Build a High-Performing React Applications

What’s the 101? the useState Hook in React

Alternative to React Hook Form

decodingReact