import { Link as ReactRouterLink , LinkProps as ReactRouterLinkProps , } from "react-router-dom" ; import React from "react" ; type LinkProps = ReactRouterLinkProps ; const Link = ( { children , to , ... props } ) => { const internal = typeof to === "string" ? /^\/(?!\/)/ . test ( to ) : true ; if ( internal || typeof to !== "string" ) { return ( < ReactRouterLink to = { to } { ... props } > { children } < /ReactRouterLink>); } return ( < a href = { to } { ... props } > { children } < /a>); } ; export default Link ;