Why is this code not working?
The updateCurrentSong
is not even running on click
const currentSong = useRecoilValue(currentSongState)
const updateCurrentSong = useRecoilCallback(({snap, set}) => () => {
set(currentSongState, prev => ({...prev, playing: !currentSong.playing}))
}, [currentSong])
return (
<div onClick={updateCurrentSong()} >
I know this is late, but I think it's because you have parentheses in your onClick attribute. I believe it should be like this: