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
toggle2function on a click to the seond button. - After adding the
toggle2function to the JSX expression in the second button'sonClickevent-handling attribute, you should un-comment the bird2 variable on lines 9 to 11. - Next, you need to define the
toggle2function: it should have the exact same functionality as thetoggle1function, but it needs to work with thebird2variable (instead of thebird1variable as it does in thetoggle1function).
This project was bootstrapped with Create React App.
- Open the built-in terminal
- Run
npm installto add thenode_modulesfolder - Run
npm start - Click the "Open Development server" in the bottom status bar to view the running react app in the browser.