Template for starting apps, powered by Next.js
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
575 B

  1. import * as React from 'react'
  2. import NextLink from 'next/link'
  3. import {UrlObject} from 'url';
  4. type Props = {
  5. href: UrlObject,
  6. as?: UrlObject,
  7. prefetch?: boolean,
  8. replace?: boolean,
  9. shallow?: boolean,
  10. component?: React.ElementType,
  11. }
  12. const Link: React.FC<Props> = ({
  13. href,
  14. as,
  15. prefetch,
  16. replace,
  17. shallow,
  18. component: Component = 'a',
  19. ...etcProps
  20. }) => {
  21. return (
  22. <NextLink
  23. href={href}
  24. as={as}
  25. passHref
  26. replace={replace}
  27. shallow={shallow}
  28. prefetch={prefetch}
  29. >
  30. <Component
  31. {...etcProps}
  32. />
  33. </NextLink>
  34. )
  35. }
  36. export default Link