Skip to main content

Playground

Play sound with onClick Event

import { useAudio } from "react-use-audio";

// You need to add sound-related files
import testSound from "../sounds/test.mp3";

function App() {
const { play } = useAudio(testSound);

return <button onClick={play}>play</button>;
}

export default App;