Baisc fetch example

Demonstrating simple data fetching with React Query's useQuery hook.

  1. useQuery Hook: Simplifies API requests and server state management.
  2. Query Key: Unique array identifier for the query.
  3. Query Function: Returns a promise, typically with an API call.
  4. Caching and Refetching: Automatic caching and refetching for up-to-date data.
  5. Loading and Error States: Manage UI states with data, error, and isLoading.

Full code for this example: Click here

Products list