2 ms·
Right, so the reasons this needs to be a hook: - As someone else said, it manages playback state. This is technically managed by a third-party library, but we
by joshwcomeau 7y ago
Right, so the reasons this needs to be a hook:
- As someone else said, it manages playback state. This is technically managed by a third-party library, but we expose an `isPlaying` boolean which is held in React state
- It lazy-loads Howler, the underlying audio dependency. This means the bundle cost is ~1kb instead of 11kb (gzip)
- It memoizes all the callback functions to avoid breaking React.memo / PureComponent components