MCPcopy
hub / github.com/joshwcomeau/use-sound / ShowWhilePlaying

Function ShowWhilePlaying

stories/demos/ShowWhilePlaying.js:7–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5import Button from '../helpers/Button';
6
7const ShowWhilePlaying = () => {
8 const [isPlaying, setIsPlaying] = React.useState(false);
9
10 const [playBoop] = useSound(dunDunDunSfx, {
11 onplay: () => setIsPlaying(true),
12 onend: () => setIsPlaying(false),
13 });
14
15 return (
16 <>
17 <h2>Is playing: {isPlaying.toString()}</h2>
18 <br />
19 <Button onClick={playBoop}>Play sound</Button>
20 </>
21 );
22};
23
24export default ShowWhilePlaying;

Callers

nothing calls this directly

Calls 1

useSoundFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…