> ## Documentation Index
> Fetch the complete documentation index at: https://orderly.network/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# useQuery

> Hook to fetch data from public API endpoints with automatic JSON serialization.

Use `useQuery` to access any public API, for example to get all available symbols on Orderly.

* [Tech docs](/sdks/tech-doc/modules/orderly_network_hooks#usequery)

```tsx theme={null}
const { data, error, isLoading } = useQuery<API.Symbol[]>("/v1/public/info");

return (
  <pre className="text-sm">
    {isLoading && <div>Loading...</div>}
    {data && <div className="text-slate-500">{JSON.stringify(data, null, 2)}</div>}
  </pre>
);
```

The `data` returned by `useQuery` is already serialized in JSON format. If you want to access the raw data, you can provide a `formatter` to override the default serialization of the hook. For example:

```tsx theme={null}
const { data, error } = useQuery("/v1/public/info", {
  formatter: (data) => data
});
```
