Example of using event-handling, if/else statements, play/pause, and referencing eternal audio (.mp3) tracks to toggle audio on and off.
- In this ungraded lab, your goal is to read through the existing code of the App.js file, and update the second button so that it's running the
toggle2
function on a click to the seond button. - After adding the
toggle2
function to the JSX expression in the second button'sonClick
event-handling attribute, you should un-comment the bird2 variable on lines 9 to 11. - Next, you need to define the
toggle2
function: it should have the exact same functionality as thetoggle1
function, but it needs to work with thebird2
variable (instead of thebird1
variable as it does in thetoggle1
function).
This project was bootstrapped with Create React App.
- Open the built-in terminal
- Run
npm install
to add thenode_modules
folder - Run
npm start
- Click the "Open Development server" in the bottom status bar to view the running react app in the browser.