Queries in a state store

There are multiple ways you can query in a state store. For example, Pinia allows you to define stores as a smaller setup functions. This allows you to use useQuery or useMutation features directly in your store as state or actions.

The following example showcases a store created using useQuery where it fetches the data from the API and shows a loading state as well.