Skip to content

Instantly share code, notes, and snippets.

@AllGistsEqual
Last active February 11, 2020 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllGistsEqual/3dd3229584a08d5dc1c0ae97ac8f62b4 to your computer and use it in GitHub Desktop.
Save AllGistsEqual/3dd3229584a08d5dc1c0ae97ac8f62b4 to your computer and use it in GitHub Desktop.
// our SpecialLink.jsx
const SpecialLink = (props) => {
const { url, label, ...additionalProps } = props
return (
<a href={url} ...additionalProps>
{label}
</a>
)
}
// somewhere in our projects where we imported the component
<SpecialLink
url="https://some.url.com"
label="Link to some URL"
/>
// <a href="https://some.url.com">Link to another URL</a>
<SpecialLink
url="https://another.url.com"
label="Link to another URL"
target="_blank"
rel="external"
/>
/*
<a
href="https://another.url.com"
target="_blank"
rel="external"
>
Link to some URL
</a>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment