Problem Statement
What does an RTK Query hook return and how do you use it in components?
Explanation
An RTK Query hook returns an object containing data (the fetched data or undefined), isLoading (true on first fetch), isFetching (true on any fetch including refetches), isSuccess, isError, error (error object if failed), and refetch function to manually trigger refetch. You destructure these values in your component like const data, isLoading, error equals useGetPostsQuery args, and conditionally render UI based on the loading and error states while displaying the data when available. The hook automatically fetches data when the component mounts, refetches when arguments change, and handles all the async complexity so you can focus on rendering the UI.
