I've created a react web application which has an HTML body content inside home.js as below,
class Home extends React.Component {
render() {
return (
<div>
<nav-bar-component></nav-bar-component>
{/* <!-- Trigger/Open The Modal --> */}
{/* <!-- banner --> */}
<header id="banner">
<div id="banner_contents">
<h1 id="banner_title"></h1>
<div id="banner_buttons">
<div id="banner_button_play">Play</div>
<div id="banner_button">My List</div>
</div>
<p id="banner_description"></p>
</div>
<div id="banner_fadeBottom"></div>
</header>
{/* <!-- trending now row --> */}
<div id="trending_head_row">
<div class="trending_row">
<h2 class="trending_row_title"></h2>
{/* <!-- <h1 class="trending_number"></h1> --> */}
<div class="trending_row_posters"></div>
</div>
</div>
{/* <!-- rows --> */}
<div id="headrow">
<div class="row">
<h2 class="row_title"></h2>
<div class="row_posters"></div>
</div>
</div>
<div id="myModal" class="modal">
{/* <!-- Modal content --> */}
<div class="modal-content">
<span class="close">×</span>
<header id="movie_cover"></header>
<div id="modal_fadeBottom"></div>
<h1 id="selected_banner_title"></h1>
<p id="selected_banner_description"></p>
<div id="info_box">
<p id="movie_cast"></p>
<br />
<p id="movie_genre"></p>
</div>
<h1>Trailer</h1>
{/* <!-- <div id="trailer_box"></div> --> */}
<iframe title="trailer_video" id="trailer"></iframe>
</div>
</div>
</div>
);
} }
The <h1> and the other heading tags are empty because I'm getting data from an API and by using the innerText function I'm assigning values for them in another js file (function.js). When I try to build my app using npm run build command I get these errors
Line 13:13: Headings must have content and the content must be accessible by a
screen reader jsx-a11y/heading-has-content
Line 26:13: Headings must have content and the content must be accessible by a
screen reader jsx-a11y/heading-has-content
Line 35:13: Headings must have content and the content must be accessible by a
screen reader jsx-a11y/heading-has-content
Line 46:13: Headings must have content and the content must be accessible by a
screen reader jsx-a11y/heading-has-content
Please help me!!!