Created
February 26, 2019 19:46
-
-
Save theuves/079ac0fbb4047e8e676e7237195a96d0 to your computer and use it in GitHub Desktop.
A component to use internal and external links with Gatsby.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Link as GatsbyLink } from 'gatsby' | |
const Link = ({ children, ...props }) => { | |
if (!props.href) { | |
return ( | |
<GatsbyLink {...props}> | |
{children} | |
</GatsbyLink> | |
) | |
} | |
return ( | |
<a {...props}> | |
{children} | |
</a> | |
) | |
} |
Author
theuves
commented
Feb 26, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment