react state not updating inside a hook (useSound)

I'm trying to add a loop feature on a spotify clone where I hold a state isLoop and control it using a button. however it is not reflected inside a method of a hook 'useSound' which uses howler.js.

I've attached the code as file.

There onend method of useSound hook doesnt gets the updated state.
Was this page helpful?