3 ms·
It's the pattern/convention that the React team used for the built-in hooks. const [ myState, setMyState ] = useState(initalValue); In this case, the "play" i
by hazz99 7y ago
It's the pattern/convention that the React team used for the built-in hooks.
const [ myState, setMyState ] = useState(initalValue);
In this case, the "play" is a function to play the sound, and the next array argument is an object with more useful parameters.
const [ play, args ] = useSound()
I assume it's a workaround/replacement for returning a tuple in vanilla JavaScript.