DEV Community

loading...

Use sound with hooks

davidka7 profile image davidka7 ・1 min read

First
npm install use-sound
import useSound from 'use-sound';
import someSound from '../someSound.mp3';
const playButton = () => {
const [play] = useSound(someSound);
return ;
};

Discussion

pic
Editor guide