Skip to content
Advertisement

React / react-share – How can I share not only text but also a link insight my Email etc when sharing content on social media?

I am using react-share and I wonder how /if its possible to share a link insight the email, facebook, twitter etc? I was thinking of just including an a tag but that doesnt work and I> couldnt find anything online. Any ideas? Thanks!!

<EmailShareButton
    url="www.example.com"
    subject="subject"
    body={"hey there, pls share my link" + <a href="www.example.com">Link</a>}
    className="Demo__some-network__share-button">
       <EmailIcon
         size={40}
         round/>
 </EmailShareButton>

<FacebookShareButton
     url="www.example.com"
     quote="link"
     className="Demo__some-network__share-button">
     <FacebookIcon
       size={40}
       round
     />
</FacebookShareButton>

Advertisement

Answer

Unfortunately this component is using mailto: which prevent inline html to the body. I checked EmailShareButton element on their repository, https://github.com/nygardk/react-share/blob/master/src/EmailShareButton.js#L6

It seems that url also is skipped and does no action.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement