Cannot read properties of null (reading 'useRef') when use it in Next.js
MutongXiao opened this issue · comments
MutongXiao commented
when i use it in my next.js project, I got an error:
TypeError: Cannot read properties of null (reading 'useRef')
here is my code
import useSound from 'use-sound'; const [playOn] = useSound('/sounds/switch-on.mp3'); const [playOff] = useSound('/sounds/switch-off.mp3');
i have put the mp3 in '/public/sounds/', but it does not work
how do i fix it, thank you very much
MutongXiao commented
sorry, I made a silly mistake