weddingsite/components/NavLink.js

15 lines
350 B
JavaScript
Raw Permalink Normal View History

2021-06-04 00:58:40 +00:00
import React from 'react';
import Link from 'next/link';
import { useRouter } from 'next/router';
export const NavLink = ({ href, children }) => {
const { asPath } = useRouter();
const ariaCurrent = href === asPath ? 'page' : undefined;
2021-06-04 00:58:40 +00:00
return (
<Link prefetch href={href} aria-current={ariaCurrent}>
{children}
2021-06-04 00:58:40 +00:00
</Link>
);
};