Basically I have a header like this,
function Header() {
return (
<div className="header">
<nav className="navbar navbar-expand-lg navbar-light fixed-top ">
<Link className="navbar-brand order-0 nav-link" to="/">
DASA
</Link>
</nav>
</div>
);
}
export default Header;
Now, whenever I want this header beside home page. I want to its fixed-top property and also want to change its background-color which I have mentioned in the css file. How would I do it?
I also looked this answer here but could not figure out how to use it in my case?
Here is my app.js file.
import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
function App() {
return (
<Router>
<div className="App">
<Switch>
{/* Men Category Route */}
<Route path="/men">
<Header></Header>
<Men></Men>
<Footer></Footer>
</Route>
{/* Women Category Route */}
<Route path="/women">
<Header></Header>
<Women></Women>
<Footer></Footer>
</Route>
{/* Women Category Route */}
<Route path="/kids">
<Header></Header>
<Kids></Kids>
<Footer></Footer>
</Route>
{/* Authentication Route */}
<Route path="/MenCategory">
<MenProduct></MenProduct>
</Route>
<Route path="/signin">
<Header></Header>
<Authentication></Authentication>
<Footer></Footer>
</Route>
{/* Home Route👇 */}
<Route path="/">
<Header></Header>
<Home></Home>
<Footer></Footer>
</Route>
</Switch>
</div>
</Router>
);
}
export default App;
Right now, I am using react-router-dom for changing my route and all that. If any other information is need please let me know.