1. Install react-sounds and add the pack with its CLI
npm i react-sounds howler
npx react-sounds-cli add https://openfoley.com/c/game-soundsInstalls the latest version; run the command again to update. Pin a version if your app needs sounds that never change. Add --download to copy the files into your project.
2. Register it and play sounds by name (names autocomplete)
import gameSounds from "./sounds/game-sounds.json";
<SoundProvider packs={[gameSounds]}>…</SoundProvider>
const { play } = useSound("game-sounds/8-bit-enemy-hit");game-sounds/8-bit-enemy-hit
game-sounds/achievement-unlocked-fanfare
game-sounds/arcade-power-up-collect
game-sounds/big-explosion-debris
game-sounds/bow-arrow-release
game-sounds/crystal-gem-ping
game-sounds/fireball-spell-whoosh
game-sounds/heavy-punch-impact
game-sounds/jelly-wobble-bounce
game-sounds/magical-sparkle-unlock
game-sounds/metal-coin-drop
game-sounds/retro-8-bit-jump
game-sounds/retro-game-over
game-sounds/scary-monster-growl
game-sounds/sci-fi-laser-blaster
game-sounds/squishy-jelly-pop
game-sounds/sword-slash-whoosh
game-sounds/triumphant-level-up-jingle