React Query is a ReactJS preconfigured data management library which gives you power and control over server-side state management, fetching and caching of data, and error handling in a simple and declarative way without affecting the global state of your application.
I built a React Query 4 basic SPFx (SharePoint) forum application where I used many features of React Query, such as, fetching data with useQuery, globally handling query errors, using useIsFetching and useIsMutating hooks, dependent queries, initial query data, paginated queries, infinite queries, imperative refetch, mutations with query invalidation, mutations with handling mutation response and mutations with optimistic updates and also how to suppress refetch.
You can download the package from here and upload it to your Tenant App Catalog to run the forum.
To get started.
Clone the repository
git clone https://github.com/Ashot72/React-Query-4-Basic-Forum
cd React-Query-4-Basic-Forum
# installs dependencies
npm install
# creates release package which should be deployed in SharePoint app catalog
npm run deploy-prod
Go to React Query 4 Basic (SPFx) Forum Video page
Go to React Query 4 Basic (SPFx) description page