Reference / @open-music-sdk/react / musicQueries
Function: musicQueries()
function musicQueries(music, scope?): tMusicQueries;Defined in: integrations/react/src/query.ts:156
Every read function of the catalog and of the listener's library, as its query for TanStack Query: one function of the same arguments for each, giving what useQuery takes, or what useInfiniteQuery takes for one that walks pages. A write is not among them: it is useMutation over the client's namespace. scope goes into every key, so that one listener's cache is never another's: useMusicQueries passes the provider's scope, a new one for every sign-in. A token is never part of a key. No staleTime is set: that is your app's to choose. Made once for one client and reused; nothing is asked until a query runs.
Parameters
music
The client the queries ask through: from createClient, createServerClient or createBrowserClient, or anything with its five functions.
scope?
string | number
What tells one listener's keys from another's: the provider's scope, or your own. Default 0, the scope of a page's client before any sign-in, so a server's prefetch of the catalog matches the page's queries.
Returns
The two namespaces of query builders, frozen.
Throws
TypeError if music is not a client, or scope is neither a string nor a number.