ReferencePlayer
useOptionalPlayer
Hook to access or select Player state when a Player is available
Import
Usage
Without a selector, the hook returns the player store or undefined outside Player.
With a selector, it subscribes while a player is available and returns the selected value. The selector is not called outside Player.
Use usePlayer when the component requires a surrounding player.
API Reference
Without Selector
useOptionalPlayer(): UnknownStore | undefined
Returns the player store when available, or undefined outside a Player.
Return Value
With Selector
useOptionalPlayer<R>(selector): R | undefined
Selects a player value when available, or returns undefined outside a Player.
Parameters
Return Value
R | undefined