Issue
I would like to create an app using semantic html. The app will have header, navigation, main area, footer, and side bar.
The app uses react, so there is an index.js and index.html. This is where react renders an element into the root DOM node.
index.js
render(<App />, document.getElementById('root'))
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Title</title>
</head>
<body>
//<div id="root"></div>
// <main id="root"></main>
// <section id="root"></section>
</body>
</html>
I expect the app to produce something similar to:
<some root node>
<header>
<nav>
<main>
<aside>
<footer>
Since React requires a root node, what element type should that be (what is the most semantically correct)? The root node is inside index.html, therefore a fragment will not solve the problem. I've commented out a few ideas inside index.html which are div, main, and section.
Solution
<main>
is supposed to relate to the dominant part of the content. If you wish to have navigation, header and/or sidebar and things like that it seems more apropriate to use a div for the App and use the <main>
tag for the main content on the page.
Answered By - Achtung
Answer Checked By - - Candace Johnson (ReactFix Volunteer)