3 ms·
useSound returns an array (used like a tuple here). The syntax you see here is Array Destructuring. This way you access the 0th element directly. Equivalent o
by gherkinnn 7y ago
useSound returns an array (used like a tuple here).
The syntax you see here is Array Destructuring. This way you access the 0th element directly.
Equivalent of:
const hook = useSound()
const play = hook[0]
If you want to just take the 2nd item, you can destructure like this: const [, pause] = useSound().