Data Fetching with Tanstack Query

Data Fetching with Tanstack Query

What is TanStack Query :

TANStack query is easiest way to data fetching ,catching and update server state in your web application. The main purpose tanstack query is to simplify data fetching process. it' provided convenient and advance feature that helps you manage data fetching.

useQuery hooks:

tanstack provide useQuery() hook for data fetching. useQuery hooks get object (querykey, queryFn and retry).as initial value for fetching data. queryFn is a synchronous process. Request for api in this queryFn as like useEffect in axios or fetch.

retry :

If you used useEffect for data fetching if you have get server error or network error then you data may be loaded properly. in this case retry overcome this issue and get proper solution. retry value is automatically reload to trying get data from server site to client site.

To view or add a comment, sign in

More articles by Shukumar Ghosh

Explore content categories