import * as React from 'react';
import { Link } from 'react-router-dom';
/**
 * Uses react-router-dom's <Link> for relative URLs, <a> for absolute URLs. This is useful because passing an
 * absolute URL to <Link> will create an (almost certainly invalid) URL where the absolute URL is resolved to the
 * current URL, such as https://sourcegraph.com/a/b/https://example.com/c/d.
 */
export const RouterLinkOrAnchor = props => typeof props.to === 'string' && /^https?:\/\//.test(props.to) ? (React.createElement("a", Object.assign({ href: props.to }, props))) : (React.createElement(Link, Object.assign({}, props)));
//# sourceMappingURL=RouterLinkOrAnchor.js.map