First when I import the function component and try using it in app.js file, then the component is not rendered. From the image, we can see that the header that we import is not being used
The code for the app.js file is here.
this is my code for the app.js file.
import "./App.css";
import header from "./myComponents/header";
function App() {
return (
<>
<div>hello there</div>
<header/>
</>
);
}
export default App;
and here is how it looks like when I run the server.
and this is my navigation bar code written in my header.js file.
import React from "react";
export default function header() {
return (
<nav className="navbar navbar-expand-lg navbar-light bg-light">
<div className="container-fluid">
<a className="navbar-brand" href="#">
Todos list
</a>
<button
className="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span className="navbar-toggler-icon"></span>
</button>
<div className="collapse navbar-collapse" id="navbarSupportedContent">
<ul className="navbar-nav me-auto mb-2 mb-lg-0">
<li className="nav-item">
<a className="nav-link active" aria-current="page" href="#">
Home
</a>
</li>
<li className="nav-item">
<a className="nav-link" href="#">
About
</a>
</li>
</ul>
<form className="d-flex">
<input
className="form-control me-2"
type="search"
placeholder="Search"
aria-label="Search"
/>
<button className="btn btn-outline-success" type="submit">
Search
</button>
</form>
</div>
</div>
</nav>
);
}