Reference / @open-music-sdk/react / MusicProvider
Function: MusicProvider()
function MusicProvider(props): ReactElement;Defined in: integrations/react/src/client.ts:53
Holds the client and the listener's token, in React state and nowhere else: in memory, gone with the page. No token arrives as a prop, since a prop from a server component is written into the page; useMusicUserToken and the sign-in hand it over. useMusic gives the client bound to it, derived once here, so every component shares one client and one storefront lookup. The token is in the provider's state and its context value, where React DevTools, and a browser extension that uses its hook, can show it.
Parameters
props
The client, and the tree the hooks are used in.
Returns
ReactElement
The context's provider around children.
Throws
TypeError if music is not a client from createBrowserClient.