Reference / @open-music-sdk/react / useConnect
Function: useConnect()
function useConnect(options): tUseConnect;Defined in: integrations/react/src/client.ts:164
Apple's sign-in, as createConnect runs it: the helper is made when the component mounts, from the provider's client, and disposed when it unmounts. The token a returning listener's script restored goes to the provider, unless the provider holds one already or the app has forgotten one; the token connect() gives always does. The options are read on the first mount only, as the helper reads them once.
Parameters
options
The app as Apple's script is configured with it, and the page's own MusicKit where it loaded the script itself.
Returns
Where the sign-in stands, and connect and disconnect, each keeping its identity.
Throws
TypeError if there is no MusicProvider above the component; what createConnect refuses in the options, a mount with no document, or a page whose script is configured for another app, is a TypeError thrown when the component mounts, from the effect, so it reaches the nearest error boundary rather than this call.