If You want to click on a link and share some custom text, url or hashtags on social networks websites then use the following examples on any href
property of <a>
Share intention Twitter
<a href={`https://twitter.com/intent/tweet?text=${encodeURIComponent(TEXT)}&url=${encodeURIComponent(URL)}&hashtags=tag1,tag2}`}>Share on Twitter</a>
Share intention Facebook
<a href={`https://www.facebook.com/sharer.php?u=${encodeURIComponent(URL)}"e=${encodeURIComponent(TEXT)}`}>Share on Facebook</a>
Share intention WhatsApp (mobile only)
<a href={`https://wa.me/?text=${encodeURIComponent(TEXT)}%20${encodeURIComponent(URL)}`}>Share on WhatsApp</a>
CodeSandbox available 🙂
Top comments (0)