📅  最后修改于: 2022-03-11 15:03:26.947000             🧑  作者: Mango
// React Router v6
import { NavLink } from 'react-router-dom';
function NavBar() {
// inline or css classes
let activeStyle = { color: 'green', textDecoration: 'underline' };
let activeClass = 'activated';
return (
);
}
// Special kind of that knows when it is 'active'
// the styling applies to a when route it links to
// is currently selected.
/*
index.css
a, .nav-link { color: 'blue', text-decoration: 'none' }
.activated { color: 'green', text-decoration: 'underline' }
*/
// React Router v5
function NavBar() {
return (
);
}