Skip to content

Commit

Permalink
fix NextLink + React.forwardRef
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonlesisz authored and zuzjes committed Oct 2, 2019
1 parent b3f28e9 commit f795443
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/suite/src/components/suite/Link/index.tsx
Expand Up @@ -24,6 +24,11 @@ const Link = ({ children, href, className, target = '_self', ...rest }: Props) =
};

const { prefetch, shallow, scroll, replace, ...linkProps } = rest;
const WrappedLink = React.forwardRef(() => (
<TLink target={target} {...linkProps} className={className}>
{children}
</TLink>
));

return (
<NextLink
Expand All @@ -35,9 +40,7 @@ const Link = ({ children, href, className, target = '_self', ...rest }: Props) =
passHref
{...overrideAsProp}
>
<TLink target={target} {...linkProps} className={className}>
{children}
</TLink>
<WrappedLink />
</NextLink>
);
};
Expand Down

0 comments on commit f795443

Please sign in to comment.