Last active
May 4, 2023 10:54
-
-
Save ernestofreyreg/55e765cf53d4cf55d5c577544c232014 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 NextLink, { LinkProps } from 'next/link' | |
import { format } from 'url' | |
import getConfig from 'next/config' | |
const { publicRuntimeConfig } = getConfig() | |
const Link: React.FunctionComponent<LinkProps> = ({ children, ...props }) => ( | |
<NextLink | |
{...props} | |
as={`${publicRuntimeConfig.basePath || ''}${format(props.href)}`} | |
> | |
{children} | |
</NextLink> | |
) | |
export default Link |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Missing children validation: use
const Link: React.FC<React.PropsWithChildren<LinkProps>>