TanStack Query Status

 Your query can be in one of the following states:

  • success: Your query was successful, and you have data for it
  • error: Your query did not work, and an error is set
  • pending: Your query has no data

Note that the isFetching flag is not part of the internal state machine - it is an additional flag that will be true whenever a request is in-flight. You can be fetching and success, you can be fetching and error - but you cannot be loading and success at the same time. The state machine makes sure of that.

Reference

Status Checks in React Query | TkDodo’s blog