Is there a way to dynamically change the color of the navbar text based on the page being browsed?
For instance, when on the homepage, I'd like the home icon to appear in blue.
https://i.sstatic.net/uTfwP.png
Take a look at my Menu.js
file below:
import React from "react";
import { Link, withRouter } from "react-router-dom";
const Menu = () => {
return (
<div className="wrapper">
<div className="row">
<nav>
<Link to="/home">
<i className="fas fa-home"></i>
</Link>
<Link to="/search">
<i className="fas fa-search"></i>
</Link>
<Link to="/notifications">
<i className="fas fa-bell"></i>
</Link>
<Link to="/messages">
<i className="fas fa-envelope"></i>
</Link>
<Link to="/profile">
<i className="fas fa-user"></i>
</Link>
<Link to="/signout">
<i className="fas fa-sign-out-alt"></i>
</Link>
</nav>
</div>
</div>
);
};
export default withRouter(Menu);
I'm struggling to determine the current page location. Can you help?