This is the code I have tried, I can't figure out what is going wrong here, but when I try to call the "changePlayingStatus" function on a click event, the error is raised.
const [playing, togglePlaying] = useState(false);
const [audio] = useState(new Audio("bg_music.mp3"));
const changePlayingStatus = () => {
playing ? audio.pause() : audio.play();
togglePlaying(!playing);
}