HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URL's added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by Skypack, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ES6 import
usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<!--
Hello Camper!
For now, the test suite only works in Chrome! Please read the README below in the JS Editor before beginning. Feel free to delete this message once you have read it. Good luck and Happy Coding!
- The freeCodeCamp Team
-->
<div id="app-root"></div>
<div id="modal-root"></div>
body {
margin-top: 40px
}
#modal-root {
position: relative;
z-index: 999;
}
.modal-div {
background-color: rgba(0,0,0,0.5);
position: fixed;
height: 100%;
width: 100%;
top: 0;
left: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
// !! IMPORTANT README:
// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place.
/***********
INSTRUCTIONS:
- Select the project you would
like to complete from the dropdown
menu.
- Click the "RUN TESTS" button to
run the tests against the blank
pen.
- Click the "TESTS" button to see
the individual test cases.
(should all be failing at first)
- Start coding! As you fulfill each
test case, you will see them go
from red to green.
- As you start to build out your
project, when tests are failing,
you should get helpful errors
along the way!
************/
// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!
// Once you have read the above messages, you can delete all comments.
//Constants where the application and its modal components will be rendered to in the actual DOM.
const appRoot = document.getElementById("app-root");
const modalRoot = document.getElementById("modal-root");
//Arrays:
//This is the array that deals with the styling for each drum machine.
const themesForDrumMachine = [{id: "starWars",
movieBanner: "https://raw.githubusercontent.com/TazExprez/Logos/master/StarWars.jpg",
leftArrowButtonColor: "#E4B77D",
leftArrowButtonHoverColor: "yellow",
rightArrowButtonColor: "#E4B77D",
rightArrowButtonHoverColor: "yellow",
imageBorderColor: "#E4B77D",
bodyBackgroundColor: 'url("https://raw.githubusercontent.com/TazExprez/Logos/master/StarWarsBackground.jpg")',
fontFamily: "StarWarsFont",
arrowSound: "https://raw.githubusercontent.com/TazExprez/Logos/master/StarWarsArrowSound.mp3",
moviePhrase: "https://raw.githubusercontent.com/TazExprez/Logos/master/StarWarsPhrase.mp3",
youTubeVideoSource: "https://www.youtube.com/embed/v5CA6rK2aLQ?enablejsapi=1&version=3&playerapiid=ytplayer&rel=0",
youTubeVideoDivBackgroundColor: "#E4B77D"},
{id: "schindlersList",
movieBanner: "https://raw.githubusercontent.com/TazExprez/Logos/master/SchindlersList.jpg",
leftArrowButtonColor: "white",
leftArrowButtonHoverColor: "#BB3F3F",
rightArrowButtonColor: "white",
rightArrowButtonHoverColor: "#BB3F3F",
imageBorderColor: "white",
bodyBackgroundColor: 'url("https://raw.githubusercontent.com/TazExprez/Logos/master/SchindlersListBackground.jpg")',
fontFamily: "SchindlersListFont",
arrowSound: "https://raw.githubusercontent.com/TazExprez/Logos/master/SchindlersListArrowSound.mp3",
moviePhrase: "https://raw.githubusercontent.com/TazExprez/Logos/master/SchindlersListPhrase.mp3",
youTubeVideoSource: "https://www.youtube.com/embed/sFSWlfZ4CXM?enablejsapi=1&version=3&playerapiid=ytplayer&rel=0",
youTubeVideoDivBackgroundColor: "white"},
{id: "batman",
movieBanner: "https://raw.githubusercontent.com/TazExprez/Logos/master/Batman.jpg",
leftArrowButtonColor: "lightblue",
leftArrowButtonHoverColor: "white",
rightArrowButtonColor: "lightblue",
rightArrowButtonHoverColor: "white",
imageBorderColor: "white",
bodyBackgroundColor: 'url("https://raw.githubusercontent.com/TazExprez/Logos/master/BatmanBackground.jpg")',
fontFamily: "BatmanFont",
arrowSound: "https://raw.githubusercontent.com/TazExprez/Logos/master/BatmanArrowSound.mp3",
moviePhrase: "https://raw.githubusercontent.com/TazExprez/Logos/master/BatmanPhrase.mp3",
youTubeVideoSource: "https://www.youtube.com/embed/n_Klu8YTub8?enablejsapi=1&version=3&playerapiid=ytplayer&rel=0",
youTubeVideoDivBackgroundColor: "white"},
{id: "rocky",
movieBanner: "https://raw.githubusercontent.com/TazExprez/Logos/master/Rocky.jpg",
leftArrowButtonColor: "red",
leftArrowButtonHoverColor: "white",
rightArrowButtonColor: "blue",
rightArrowButtonHoverColor:"white",
imageBorderColor: "white",
bodyBackgroundColor: 'url("https://raw.githubusercontent.com/TazExprez/Logos/master/RockyBackground2.jpg")',
fontFamily: "RockyFont",
arrowSound: "https://raw.githubusercontent.com/TazExprez/Logos/master/RockyArrowSound.mp3",
moviePhrase: "https://raw.githubusercontent.com/TazExprez/Logos/master/RockyPhrase.mp3",
youTubeVideoSource: "https://www.youtube.com/embed/GVLSIRItfKY?enablejsapi=1&version=3&playerapiid=ytplayer&rel=0",
youTubeVideoDivBackgroundColor: "white"}];
const fullTracks = [{id: "starWarsFullTrack", fullTrack: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMFullTrack.mp3"},
{id: "schindlersListFullTrack", fullTrack: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLFullTrack.mp3"},
{id: "batmanFullTrack", fullTrack: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKFullTrack.mp3"},
{id: "rockyFullTrack", fullTrack: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDFullTrack.mp3"}]
//This is the array that contains all of the properties of each drum pad.
const drumPadContent = [[{id: "Q", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack1.mp3", keyboardKey: 81},
{id: "W", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack2.mp3", keyboardKey: 87},
{id: "E", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack3.mp3", keyboardKey: 69},
{id: "A", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack4.mp3", keyboardKey: 65},
{id: "S", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack5.mp3", keyboardKey: 83},
{id: "D", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack6.mp3", keyboardKey: 68},
{id: "Z", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack7.mp3", keyboardKey: 90},
{id: "X", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack8.mp3", keyboardKey: 88},
{id: "C", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/IMTrack9.mp3", keyboardKey: 67}],
[{id: "Q", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack1.mp3", keyboardKey: 81},
{id: "W", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack2.mp3", keyboardKey: 87},
{id: "E", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack3.mp3", keyboardKey: 69},
{id: "A", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack4.mp3", keyboardKey: 65},
{id: "S", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack5.mp3", keyboardKey: 83},
{id: "D", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack6.mp3", keyboardKey: 68},
{id: "Z", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack7.mp3", keyboardKey: 90},
{id: "X", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack8.mp3", keyboardKey: 88},
{id: "C", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/SLTrack9.mp3", keyboardKey: 67}],
[{id: "Q", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack1.mp3", keyboardKey: 81},
{id: "W", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack2.mp3", keyboardKey: 87},
{id: "E", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack3.mp3", keyboardKey: 69},
{id: "A", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack4.mp3", keyboardKey: 65},
{id: "S", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack5.mp3", keyboardKey: 83},
{id: "D", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack6.mp3", keyboardKey: 68},
{id: "Z", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack7.mp3", keyboardKey: 90},
{id: "X", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack8.mp3", keyboardKey: 88},
{id: "C", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/TDKTrack9.mp3", keyboardKey: 67}],
[{id: "Q", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack1.mp3", keyboardKey: 81},
{id: "W", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack2.mp3", keyboardKey: 87},
{id: "E", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack3.mp3", keyboardKey: 69},
{id: "A", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack4.mp3", keyboardKey: 65},
{id: "S", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack5.mp3", keyboardKey: 83},
{id: "D", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack6.mp3", keyboardKey: 68},
{id: "Z", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack7.mp3", keyboardKey: 90},
{id: "X", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack8.mp3", keyboardKey: 88},
{id: "C", trackSource: "https://raw.githubusercontent.com/TazExprez/Logos/master/GTDTrack9.mp3", keyboardKey: 67}]];
//This is the array that contains all of the audio that is played when the user switches the level of effects.
const effectsLevelChangeConfirmationSounds = [{id: "moreEffects",
goToMoreEffectsSound: "https://raw.githubusercontent.com/TazExprez/Logos/master/Applause.mp3"},
{id: "noMoreEffects",
leaveMoreEffectsSound: "https://raw.githubusercontent.com/TazExprez/Logos/master/DuckHuntDogLaugh.mp3"},
{id: "extremeEffects",
goToExtremeEffectsSound: "https://raw.githubusercontent.com/TazExprez/Logos/master/MichaelBufferLGRTR.mp3"},
{id: "noExtremeEffects",
leaveExtremeEffectsSound: "https://raw.githubusercontent.com/TazExprez/Logos/master/KWSPleaseDontGo.mp3"}];
//Redux:
const SELECTED_THEME_AND_MUSIC_SLOT = 'SELECTED_THEME_AND_MUSIC_SLOT';
const DEFAULT_SELECTED_THEME_AND_MUSIC_SLOT = 0;
const CHANGE_DISPLAY = 'CHANGE_DISPLAY';
const DEFAULT_DISPLAY = 'TESTING';
const KEYBOARD_KEY_PRESSED = 'KEYBOARD_KEY_PRESSED';
const DEFAULT_KEYBOARD_KEY_PRESSED = null;
//This is the action creator function for changing the theme of the drum pad.
const selectedThemeAndMusicSlotActionCreator = (themeAndMusicSlot) => ({
type: SELECTED_THEME_AND_MUSIC_SLOT,
selectedThemeAndMusicSlot: themeAndMusicSlot
});
//This is the reducer function that returns the part of the state that selects the current drum machine theme.
const selectedThemeAndMusicSlotReducer = (state = DEFAULT_SELECTED_THEME_AND_MUSIC_SLOT, action) => {
switch(action.type) {
case SELECTED_THEME_AND_MUSIC_SLOT:
return action.selectedThemeAndMusicSlot;
default:
return state;
}
};
//This is the action creator function for selecting the track to play.
const keyboardKeyPressedActionCreator = (keyboardKeySelected) => ({
type: KEYBOARD_KEY_PRESSED,
keyboardKeyPressed: keyboardKeySelected
});
//This is the reducer function that returns the part of the state that selects the track to play.
const keyboardKeyPressedReducer = (state = DEFAULT_KEYBOARD_KEY_PRESSED, action) => {
switch(action.type) {
case KEYBOARD_KEY_PRESSED:
return action.keyboardKeyPressed;
default:
return state;
}
};
//This is the action creator function for selecting what to show on the drum machine display.
const changeDisplayActionCreator = (displayItemChosen) => ({
type: CHANGE_DISPLAY,
specificItemToDisplay: displayItemChosen
});
//This is the reducer function that returns the part of the state that selects what to show on the drum machine display.
const changeDisplayReducer = (state = DEFAULT_DISPLAY, action) => {
switch(action.type) {
case CHANGE_DISPLAY:
return action.specificItemToDisplay;
default:
return state;
}
};
const rootReducer = Redux.combineReducers({
themeAndMusicSlot: selectedThemeAndMusicSlotReducer,
keyboard: keyboardKeyPressedReducer,
display: changeDisplayReducer
});
const store = Redux.createStore(rootReducer);
//React:
//This is the component that constructs all of the modal boxes.
const Modal = (props) => {
const modalDivElement = document.createElement('div');
React.useEffect(() => {
modalRoot.appendChild(modalDivElement);
return () => {modalRoot.removeChild(modalDivElement)}
}, []);
return ReactDOM.createPortal(props.children, modalDivElement);
}
const ThemeBanner = () => {
const themeAndMusicSlot = ReactRedux.useSelector(state => state.themeAndMusicSlot, ReactRedux.shallowEqual);
return(
<div className="ThemeBanner">
<img className="ThemeBanner-theme-image" src={themesForDrumMachine[themeAndMusicSlot].movieBanner}/>
</div>
);
}
const LeftArrow = () => {
const audioRef = React.useRef(null);
const dispatch = ReactRedux.useDispatch();
const pressedKeyboardKey = ReactRedux.useSelector(state => state.keyboard, ReactRedux.shallowEqual);
const keyboardKey = 37;
let themeAndMusicSlot = ReactRedux.useSelector(state => state.themeAndMusicSlot, ReactRedux.shallowEqual);
const changeThemeAndMusicSlotToLeft = () => {
if (themeAndMusicSlot === 0) {
themeAndMusicSlot = themesForDrumMachine.length - 1;
}
else {
themeAndMusicSlot -= 1;
}
setTimeout(() => {
audioRef.current.play();
}, 1);
dispatch(selectedThemeAndMusicSlotActionCreator(themeAndMusicSlot));
}
//This if statement is executed by keyboard key presses.
if (pressedKeyboardKey === keyboardKey) {
changeThemeAndMusicSlotToLeft();
dispatch(keyboardKeyPressedActionCreator(DEFAULT_KEYBOARD_KEY_PRESSED));
}
return(
<div className="LeftArrow">
<h4 onClick={() => changeThemeAndMusicSlotToLeft()}>Left Arrow</h4>
<audio ref={audioRef} className="ArrowSound" src={themesForDrumMachine[themeAndMusicSlot].arrowSound} type="audio/mpeg" crossOrigin="anonymous" />
</div>
);
}
const RightArrow = () => {
const audioRef = React.useRef(null);
const dispatch = ReactRedux.useDispatch();
const pressedKeyboardKey = ReactRedux.useSelector(state => state.keyboard, ReactRedux.shallowEqual);
const keyboardKey = 39;
let themeAndMusicSlot = ReactRedux.useSelector(state => state.themeAndMusicSlot, ReactRedux.shallowEqual);
const changeThemeAndMusicSlotToRight = () => {
if (themeAndMusicSlot === themesForDrumMachine.length - 1) {
themeAndMusicSlot = 0;
}
else {
themeAndMusicSlot += 1;
}
setTimeout(() => {
audioRef.current.play();
}, 1);
dispatch(selectedThemeAndMusicSlotActionCreator(themeAndMusicSlot));
}
//This if statement is executed by keyboard key presses.
if (pressedKeyboardKey === keyboardKey) {
changeThemeAndMusicSlotToRight();
dispatch(keyboardKeyPressedActionCreator(DEFAULT_KEYBOARD_KEY_PRESSED));
}
return(
<div className="RightArrow">
<h4 onClick={() => changeThemeAndMusicSlotToRight()}>Right Arrow</h4>
<audio ref={audioRef} className="ArrowSound" src={themesForDrumMachine[themeAndMusicSlot].arrowSound} type="audio/mpeg" crossOrigin="anonymous" />
</div>
);
}
const ThemeAndMusicSelection = () => {
return(
<div className="ThemeAndMusicSelection">
<LeftArrow />
<ThemeBanner />
<RightArrow />
</div>
);
}
//This is the functional component that display which key is currently being pressed.
const Display = () => {
const display = ReactRedux.useSelector(state => state.display, ReactRedux.shallowEqual);
return(
<div className="Display" id="display">
{display}
</div>
);
}
//This is the functinal component for each drum pad.
const DrumPad = ({id, track, keyboardKey}) => {
const audioRef = React.useRef(null);
const dispatch = ReactRedux.useDispatch();
const pressedKeyboardKey = ReactRedux.useSelector(state => state.keyboard, ReactRedux.shallowEqual);
const playAudioAndChangeDisplay = () => {
audioRef.current.play();
//This dispatch function changes what is displayed in the drum machine's display.
dispatch(changeDisplayActionCreator(id));
}
//This if statement is executed by keyboard key presses.
if (pressedKeyboardKey === keyboardKey) {
playAudioAndChangeDisplay();
dispatch(keyboardKeyPressedActionCreator(DEFAULT_KEYBOARD_KEY_PRESSED));
}
return(
<div className="DrumPad">
<div id={"drum-pad-" + id} className="drum-pad" onClick={() => playAudioAndChangeDisplay()}>
{id}
<audio ref={audioRef} id={id} className="clip" src={track} type="audio/mpeg" crossOrigin="anonymous" />
</div>
</div>
);
}
//This is the functional component for the drum machine.
const DrumMachine = () => {
const themeAndMusicSlot = ReactRedux.useSelector(state => state.themeAndMusicSlot, ReactRedux.shallowEqual);
const [modalOnOrOff, setModalOnOrOff] = React.useState(false)
const youTubeModal = modalOnOrOff ? (
<Modal>
<div className="modal-div">
<span onClick={() => setModalOnOrOff(false)}>
X
</span>
<iframe id="youtube-video-iframe" width="560" height="315" src={themesForDrumMachine[themeAndMusicSlot].youTubeVideoSource} frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="true" allowscriptaccess="always"></iframe>
</div>
</Modal>
) : null;
return(
<div className="DrumMachine" id="drum-machine">
<div className="DrumMachine-display-div">
<Display />
</div>
<div className="DrumMachine-control-buttons-div">
<div id="DrumMachine-youtube-button-div" onClick={() => setModalOnOrOff(true)}>
Open YouTube Window
</div>
</div>
<div className="DrumMachine-drum-pads-div">
{
//This is where all of the drum pads are rendered.
drumPadContent[themeAndMusicSlot].map(eachDrumPad => (
<DrumPad
key={eachDrumPad.id}
id={eachDrumPad.id}
track={eachDrumPad.trackSource}
keyboardKey={eachDrumPad.keyboardKey}
/>
))
}
</div>
{youTubeModal}
</div>
);
}
//This is the main functional component that renders the drum machine.
const App = () => {
/*Remember to change this to true before you are done.*/ const [modalOn, setModalOff] = React.useState(false);
const appRef = React.useRef(null);
const dispatch = ReactRedux.useDispatch();
const welcomeAndHelpModal = modalOn ? (
<Modal>
<div className="modal-div">
<div>
Hello World!
</div>
<button onClick={() => setModalOff(false)}>
Turn Off
</button>
</div>
</Modal>
) : null;
//This is the function that plays a drum pad beat if the corresponding keyboard key is pressed.
const keyboardPress = (event) => {
dispatch(keyboardKeyPressedActionCreator(event.keyCode));
}
//This causes the App component to be focused when the application is first loaded.
/*React.useEffect(() => {
appRef.current.focus();
});*/
return(
<div ref={appRef} className="App" tabIndex="0" onKeyDown={() => keyboardPress(event)}>
<ThemeAndMusicSelection />
<DrumMachine />
{welcomeAndHelpModal}
</div>
);
}
//React-Redux:
const Provider = ReactRedux.Provider;
//This ReactDOM.render() will render your React component to a div with an id of root in the HTML body element.
ReactDOM.render(<Provider store={store}><App /></Provider>, appRoot);
Also see: Tab Triggers