Maps an API contract to a unified client where every endpoint is both a callable function (direct HTTP fetch) and an object with TanStack Query hooks.
The exact API contract type from defineApi().
defineApi()
const client = createClient(api, { baseUrl: '/api' });// Direct fetchconst todos = await client.todos.list();// React hooksconst { data } = client.todos.list.useQuery(); Copy
const client = createClient(api, { baseUrl: '/api' });// Direct fetchconst todos = await client.todos.list();// React hooksconst { data } = client.todos.list.useQuery();
Maps an API contract to a unified client where every endpoint is both a callable function (direct HTTP fetch) and an object with TanStack Query hooks.