Skip to content

Commit c45e879

Browse files
committed
Configured nav area to use Next router's path
1 parent 910ef92 commit c45e879

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ yarn-error.log*
2828
.env.development.local
2929
.env.test.local
3030
.env.production.local
31+
32+
/.idea/

components/header.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import {Nav, Navbar} from "react-bootstrap";
22
import Link from "next/link";
33
import SourceCodeLink from "./sourceCodeLink";
4+
import {useRouter} from "next/router";
45

56
export default function Header() {
7+
const router = useRouter();
8+
69
return (
710
<Navbar>
8-
<Nav>
11+
<Nav activeKey={router.pathname}>
912
<Link href="/" passHref>
1013
<Nav.Link>Home</Nav.Link>
1114
</Link>

pages/bs-native-html5.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ function ValidatedFormControl({
4040
}
4141

4242
export default function BsNativeHtml5() {
43-
const [values, setValues] = useState({favoriteNumber: 42});
43+
const [values, setValues] = useState({
44+
yourName: "",
45+
favoriteNumber: 42
46+
});
4447
const [submitted, setSubmitted] = useState({});
4548
const [validated, setValidated] = useState(false);
4649

0 commit comments

Comments
 (0)