Posting Data to Server from React - Query Updates from Mutations

Опубликовано: 01 Ноябрь 2024
на канале: Leigh Halliday
15,844
603

In React you often need to persist data to the server. This video shows how to use react-query mutation functionality to post data to the server, and update the UI with fresh content. We cover three approaches to UI updates, going from easiest but worst performing, to most complicated but best performing.

**Correction**: The return value from onMutate (used when calling rollback()) should be something like this, a function which when called will reset the state back to its previous value: https://github.com/leighhalliday/next...

00:00 - Introduction
01:45 - Querying Data
05:36 - Mutating Data
10:40 - With Refetching Data
12:40 - With Response Cache Update
15:00 - With Optimistic Cache Update
21:00 - Review

Join me on Discord!   / discord  
Source: https://github.com/leighhalliday/next...
Docs: https://github.com/tannerlinsley/reac...