Baisc fetch example
Demonstrating simple data fetching with React Query's useQuery hook.
- useQuery Hook: Simplifies API requests and server state management.
- Query Key: Unique array identifier for the query.
- Query Function: Returns a promise, typically with an API call.
- Caching and Refetching: Automatic caching and refetching for up-to-date data.
- Loading and Error States: Manage UI states with data, error, and isLoading.
Full code for this example: Click here
Products list