Installation
npm install lesca-facebook-share --save
Demo
Live Demo
Usage
import Facebook from 'lesca-facebook-share';
Facebook.install('facebook-app-id');
import Facebook from 'lesca-facebook-share';
function share() {
Facebook.share({
url: 'https://github.com/jameshsu1125/lesca-facebook-share',
quote: 'use share facebook api simply',
hashtag: 'lesca_facebook_share',
redirect_uri: window.location.href,
});
}
<button onClick={share}>share to facebook</button>;
Methods
method | options | description | default |
---|
.install(uid) | uid | install FB.js with facebook app id | |
.share({ url, hashtag, quote, redirect_uri }) | url | The URL you want to share | |
| hashtag | with hashtag | |
| quote | with quote | |
| redirect_uri | mobile device necessary | location root |