Created
August 9, 2021 06:33
-
-
Save percybolmer/587fb95d992647d902152ed520bb790c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { NavLink , useHistory} from "react-router-dom"; | |
function Navbar() { | |
let history = useHistory(); | |
function goHome(path) { | |
history.push("/"); | |
} | |
return ( | |
<div className="navbar"> | |
<button type="button" onClick={goHome}><h1>Navbar</h1></button> | |
<ul> | |
<li><NavLink exact to="/">Home</NavLink></li> | |
<li><NavLink to="/contact">Contact</NavLink></li> | |
<li><NavLink to="/about">About</NavLink></li> | |
<li><NavLink to={{ | |
pathname: "/profile/percybolmer", | |
state: { registrationdate: "2021-07-07" }, | |
}}>Profile</NavLink></li> | |
</ul> | |
</div> | |
) | |
} | |
export default Navbar; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment