Skip to content
Client
Server

Reference / @open-music-sdk/react / useMusic

Function: useMusic() ​

ts
function useMusic(): tBrowserMusic;

Defined in: integrations/react/src/client.ts:92

The provider's client, bound to the listener while a token is held. One object for every component.

Returns ​

tBrowserMusic

The client: music.as(token) while a token is held, else music as it was handed to the provider.

Throws ​

TypeError if there is no MusicProvider above the component.

MIT licensed. Not affiliated with, endorsed by, or sponsored by Apple Inc. Apple Music and MusicKit are trademarks of Apple Inc.