Skip to content

Instantly share code, notes, and snippets.

@bolub
Last active February 25, 2021 07:00
Show Gist options
  • Save bolub/695a8ff30533ddf99c81ddd52708d3b3 to your computer and use it in GitHub Desktop.
Save bolub/695a8ff30533ddf99c81ddd52708d3b3 to your computer and use it in GitHub Desktop.
Social share
// variables
const dummyDescription = "check this out";
const dummyUrl = "http://google.com"
const dummyPhoneNumber = "23400112233"
// facebook
const facebookLink = `https://www.facebook.com/sharer/sharer.php?u=${dummyDescription}`
// twitter
const twitterLink = `http://twitter.com/share?text=${dummyDescription}&url=${dummyUrl}`
// whatsapp
const whatsappLink = `https://api.whatsapp.com/send?phone=${dummyPhoneNumber}&text=${dummyDescription}`
// telegram
const telegramLink = `https://t.me/share/url?url=${dummyUrl}&text=${dummyDescription}`
const Test = ()=>{
return(
<div>
<a href={whatsappLink}>
Click to go to whatsapp
</a>
<a href={twitterLink}>
Click to go to twitter
</a>
<a href={facebookLink}>
Click to go to facebook
</a>
<a href={telegramLink}>
Click to go to telegram
</a>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment