State Management with React Query: Improve developer and user experience by mastering server state in React

Afonso, Daniel

  • 出版商: Packt Publishing
  • 出版日期: 2023-05-12
  • 售價: $1,270
  • 貴賓價: 9.5$1,207
  • 語言: 英文
  • 頁數: 228
  • 裝訂: Quality Paper - also called trade paper
  • ISBN: 1803231343
  • ISBN-13: 9781803231341
  • 相關分類: React使用者經驗 UX
  • 下單後立即進貨 (約3~4週)

商品描述

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 with each
  • Understand how React Query addresses server state challenges by facilitating data fetching and mutations
  • Apply the knowledge gained to improve developer experience and build applications with improved UX

Book Description

State management, a crucial aspect of the React ecosystem, has gained significant attention in recent times. While React offers various libraries and tools to handle state, each with different approaches and perspectives, one thing is clear: state management solutions for handling client state are not optimized for dealing with server state. React Query was created to address this issue of managing your server state, and this guide will equip you with the knowledge and skills needed to effectively use React Query for state management.

Starting with a brief history of state management in the React ecosystem, you'll find out what prompted the split from a global state to client and server state and thus understand the need for React Query. As you progress through the chapters, you'll see how React Query enables you to perform server state tasks such as fetching, caching, updating, and synchronizing your data with the server. But that's not all; once you've mastered React Query, you'll be able to apply this knowledge to handle server state with server-side rendering frameworks as well. You'll also work with patterns to test your code by leveraging the testing library and Mock Service Worker.

By the end of this book, you'll have gained a new perspective of state and be able to leverage React Query to overcome the obstacles associated with server state.

What you will learn

  • Get to grips with state and how it's typically managed
  • Install and configure React Query and its Devtools
  • Manage server state data fetching with the useQuery hook
  • Create, update, and delete data using the useMutation hook
  • Employ React Query in combination with frameworks such as Next.js and Remix
  • Explore MSW and the testing library to test React Query using components and hooks

Who this book is for

The book is for React developers who want to improve their state management skills and overcome the hurdles brought about by server state while improving their developer and user experience. Basic knowledge of web development and React will assist with understanding key concepts covered in this book. JavaScript developers will also find it useful.

商品描述(中文翻譯)

在學習React中管理伺服器狀態的最受歡迎的庫之一時,克服數據提取和數據變異的常見挑戰。

購買印刷版或Kindle書籍將包括免費的PDF電子書。

主要特點:

- 了解狀態如何分為伺服器狀態和客戶端狀態以及每個狀態的常見挑戰。
- 了解React Query如何通過促進數據提取和變異來解決伺服器狀態挑戰。
- 應用所學知識,改善開發者體驗並構建具有改進用戶體驗的應用程序。

書籍描述:

狀態管理是React生態系統中的一個關鍵方面,在最近引起了相當大的關注。雖然React提供了各種處理狀態的庫和工具,每個庫都有不同的方法和觀點,但有一點是清楚的:處理客戶端狀態的狀態管理解決方案並不適用於處理伺服器狀態。React Query是為解決這個管理伺服器狀態的問題而創建的,本指南將為您提供使用React Query進行狀態管理所需的知識和技能。

從React生態系統中狀態管理的簡要歷史開始,您將了解從全局狀態到客戶端和伺服器狀態的分離以及因此了解React Query的需求。隨著章節的進展,您將看到React Query如何使您能夠執行伺服器狀態任務,例如提取、緩存、更新和與伺服器同步數據。但這還不是全部;一旦您掌握了React Query,您將能夠將這些知識應用於使用伺服器端渲染框架處理伺服器狀態。您還將使用測試庫和模擬服務器工具來測試代碼的模式。

通過閱讀本書,您將獲得對狀態的新視角,並能夠利用React Query克服與伺服器狀態相關的障礙。

您將學到什麼:

- 瞭解狀態及其通常的管理方式。
- 安裝和配置React Query及其開發工具。
- 使用useQuery鉤子管理伺服器狀態數據提取。
- 使用useMutation鉤子創建、更新和刪除數據。
- 將React Query與Next.js和Remix等框架結合使用。
- 使用組件和鉤子探索MSW和測試庫來測試React Query。

本書適合對React開發人員,他們希望提高狀態管理技能,克服伺服器狀態帶來的障礙,同時改善開發者和用戶體驗。對網頁開發和React的基本知識將有助於理解本書中涵蓋的關鍵概念。JavaScript開發人員也會發現它很有用。

作者簡介

1. What Is State and How Do We Manage It?
2. Server State versus Client State
3. React Query - Introducing, Installing, and Configuring it
4. Fetching Data with React Query
5. More Data-Fetching Challenges
6. Performing Data Mutations with React Query
7. Server-Side Rendering with Next.js or Remix
8. Testing React Query Hooks and Components
9. What Changes in React Query v5

作者簡介(中文翻譯)

1. 什麼是狀態,我們如何管理它?
2. 伺服器狀態與客戶端狀態
3. React Query - 介紹、安裝和配置
4. 使用 React Query 擷取資料
5. 更多資料擷取的挑戰
6. 使用 React Query 執行資料變更
7. 使用 Next.js 或 Remix 進行伺服器端渲染
8. 測試 React Query 的 Hooks 和元件
9. React Query v5 的變更