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.
 
 

23 lines
531 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> = ({href, as, prefetch, replace, shallow, component: Component = 'a', ...etcProps}) => {
  13. return (
  14. <NextLink href={href} as={as} passHref replace={replace} shallow={shallow} prefetch={prefetch}>
  15. <Component {...etcProps} />
  16. </NextLink>
  17. )
  18. }
  19. export default Link