1.2.1 • Published 5 years ago

react-twitter-share-link v1.2.1

Weekly downloads
667
License
MIT
Repository
github
Last release
5 years ago

react-twitter-share-link

Create "share this on Twitter" links in React.

Installation

With npm:

npm install --save react-twitter-share-link

Or with Yarn:

yarn add react-twitter-share-link

Usage

import ShareLink from 'react-twitter-share-link'

...

<ShareLink link='https://your-site.com/some-page'>
   {link => (
      <a href={link} target='_blank'>Share this on Twitter</a>
   )}
</ShareLink>

ShareLink Properties

NameTypeDefaultDescription
linkstringdocument.location.hreflink the tweet will reference to
textstringnulltext before the link
hashtagsstring / string[]nullhashtags with comma or space separated string "twitter,twitterdev" / "twitter twitterdev" or array "twitter","twitterdev"
viastringnullvia references a user account at the end of the tweet (e.g "via @twitter")
relatedstring / string[]nullrelated accounts with comma or space separated string "twitter,twitterdev" / "twitter twitterdev" or array "twitter","twitterdev"
customQueryParamsstring / objectnullability to add custom query params to the tweet url