State Management with React Query Improve Developer and User Experience by Mastering Server State in React /

Beat common challenges in data fetching and data mutations while learning one of the most popular libraries for managing server state in React Purchase of the print or Kindle book includes a free PDF eBook Key Features Learn how state is split into server and client state and the common challenges w...

Full description

Bibliographic Details
Main Author: Afonso, Daniel (Author)
Other Authors: Mestre, Ricardo (writer of foreword.)
Format: eBook
Language:English
Published: Birmingham : Packt Publishing, Limited, 2023.
Edition:1st edition.
Subjects:
Online Access:Connect to the full text of this electronic book
Table of Contents:
  • Cover
  • Title Page
  • Copyright
  • Dedication
  • Contributors
  • Table of Contents
  • Preface
  • Part 1: Understanding State and Getting to Know React Query
  • Chapter 1: What Is State and How Do We Manage It?
  • Technical requirements
  • What is state in React?
  • Managing state in React
  • Managing state with useState
  • Managing state with useReducer
  • Sharing state with React Context
  • What do different state management libraries have in common?
  • Summary
  • Chapter 2: Server State versus Client State
  • Technical requirements
  • What is global state?
  • What is client state?
  • What is server state?
  • Understanding common challenges with server state
  • Caching
  • Optimistic updates
  • Deduping requests
  • Performance optimization
  • Summary
  • Chapter 3: React Query
  • Introducing, Installing, and Configuring It
  • Technical requirements
  • What is React Query?
  • Query
  • Mutation
  • How does React Query solve my server state challenges?
  • Installing React Query
  • npm
  • Yarn
  • pnpm
  • Script tag
  • Configuring React Query
  • QueryClient
  • QueryClientProvider
  • Adding React Query Devtools
  • Floating Mode
  • Embedded Mode
  • Enabling Devtools in your production build
  • Summary
  • Part 2: Managing Server State with React Query
  • Chapter 4: Fetching Data with React Query
  • Technical requirements
  • What is useQuery and how does it work?
  • What is a query key?
  • What is a query function?
  • What does useQuery return?
  • Commonly used options explained
  • Refetching data with useQuery
  • Automatic refetching
  • Manual refetching
  • Fetching dependent queries with useQuery
  • Putting it all into practice
  • Summary
  • Chapter 5: More Data-Fetching Challenges
  • Technical requirements
  • Building parallel queries
  • Manual parallel queries
  • Dynamic parallel queries
  • Leveraging QueryClient
  • Query invalidation
  • Prefetching
  • Query cancelation
  • Creating paginated queries
  • Creating infinite queries
  • Debugging your queries with Devtools
  • Summary
  • Chapter 6: Performing Data Mutations with React Query
  • Technical requirements
  • What is useMutation and how does it work?
  • What is the mutation function?
  • What does useMutation return?
  • Commonly used mutation options explained
  • Performing side-effect patterns after mutations
  • How to perform an additional side effect
  • How to retrigger a query refetch after mutation
  • How to perform an update to our query data after a mutation
  • Performing optimistic updates
  • Summary
  • Chapter 7: Server-Side Rendering with Next.js or Remix
  • Technical requirements
  • Why should I use React Query with server-side rendering frameworks?
  • Using the initialData pattern
  • Applying the initialData pattern in Next.js
  • Applying the initialData pattern in Remix
  • Using the hydrate pattern
  • Applying the hydrate pattern in Next.js
  • Applying the hydrate pattern in Remix
  • Summary