Closed nikultaka closed 3 years ago
This project is intended to be an addition to an existing React App. Instructions for how to get started are below. However, if you're simply trying to get a sound to play and not using a React App, you should use the project that this module uses: Howler which itself has lots of different ways to include it in a project.
To get started with a React App and server, you can use something like create-react-app
. If you were to use that project you could get up and running as follows:
npx create-react-app my-app
cd my-app
npm start
Then edit your App.js to include the following
import useSound from 'use-sound';
import boopSfx from '../../path/to/your/sounds/boop.mp3';
const BoopButton = () => {
const [play] = useSound(boopSfx);
return <button onClick={play}>Boop!</button>;
};
Finally, edit your App.js to use the <BoopButton/>
tag.
@nikultaka as in, you want to run it locally to work on the codebase itself?
In one terminal window, run yarn start
. In another, run yarn storybook
.
Whenever you make a change to the source files, it'll rebuild. You can test it out in the stories.
i tried npm start but it just showing Compiled successfully how to open this site in local server ?which port is using it