aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/with-create-react-app/packages/ui/src/Link.tsx
blob: 416bac83b03deb43ace949777ea10fca4bb6b937 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import * as React from "react";

interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
  children: React.ReactNode;
  href: string;
}

export const Link = (props: LinkProps) => {
  const { children, href, ...rest } = props;

  if (rest.target === "_blank") {
    rest.rel = "noopener noreferrer";
  }

  return (
    <a href={href} {...rest}>
      {children}
    </a>
  );
};