Gathering detailed insights and metrics for react-facebook
Gathering detailed insights and metrics for react-facebook
Gathering detailed insights and metrics for react-facebook
Gathering detailed insights and metrics for react-facebook
react-facebook-login
A Component React for Facebook Login
warning
A mirror of Facebook's Warning
react-player
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
@greatsumini/react-facebook-login
Well-typed React Component for Facebook Login
npm install react-facebook
Typescript
Module System
Min. Node Version
Node Version
NPM Version
92.6
Supply Chain
98.8
Quality
76.1
Maintenance
100
Vulnerability
100
License
TypeScript (94.17%)
JavaScript (5.26%)
HTML (0.57%)
Total Downloads
7,648,877
Last Day
615
Last Week
20,438
Last Month
96,728
Last Year
1,262,241
792 Stars
254 Commits
144 Forks
22 Watching
1 Branches
27 Contributors
Minified
Minified + Gzipped
Latest Version
9.0.12
Package Id
react-facebook@9.0.12
Unpacked Size
228.86 kB
Size
58.05 kB
File Count
140
NPM Version
8.19.2
Node Version
18.11.0
Cumulative downloads
Total Downloads
Last day
-0.3%
615
Compared to previous day
Last week
6.5%
20,438
Compared to previous week
Last month
-15.9%
96,728
Compared to previous month
Last year
31.4%
1,262,241
Compared to previous year
1
1
19
Become my sponsor and help me maintain this project. Thank you
By default FacebookProvider is loading facebook script immediately after render (you are able to use it with SSR). If you want to download facebook script only when facebook component is rendered you need to add parameter lazy to FacebookProvider. Use only one instance of the FacebookProvider on your page.
1import { FacebookProvider, Like } from 'react-facebook'; 2 3export default function LikeExample() { 4 return ( 5 <FacebookProvider appId="123456789"> 6 <Like href="http://www.facebook.com" colorScheme="dark" showFaces share /> 7 </FacebookProvider> 8 ); 9}
1import { FacebookProvider, useShare } from 'react-facebook'; 2 3export default function ShareExample() { 4 const { share, isLoading, error } = useShare(); 5 6 async function handleShare() { 7 await share({ 8 href: 'http://www.facebook.com', 9 }); 10 } 11 12 return ( 13 <button type="button" disabled={isLoading} onClick={handleShare}>Share</button> 14 ); 15}
You can use predefined button
1import { FacebookProvider, ShareButton } from 'react-facebook'; 2 3export default function ShareButtonExample() { 4 return ( 5 <FacebookProvider appId="123456789"> 6 <ShareButton href="http://www.facebook.com" className="my-classname"> 7 Share 8 </ShareButton> 9 </FacebookProvider> 10 ); 11}
1import { FacebookProvider, Comments } from 'react-facebook'; 2 3export default function CommentsExample() { 4 return ( 5 <FacebookProvider appId="123456789"> 6 <Comments href="http://www.facebook.com" /> 7 </FacebookProvider> 8 ); 9}
If comments do not work and you are seeing this error in the browser console:
Refused to display 'https://www.facebook.com/v3.1/plugins/comments.php?blahblahblah' in a frame because it set 'X-Frame-Options' to 'DENY'.
Possible reasons:
It is not a bug in this library, there is no way around it.
1import { FacebookProvider, CommentsCount } from 'react-facebook'; 2 3export default function CommentsCountExample() { 4 return ( 5 <FacebookProvider appId="123456789"> 6 <CommentsCount href="http://www.facebook.com" /> 7 </FacebookProvider> 8 ); 9}
1import { FacebookProvider, useLogin } from 'react-facebook'; 2 3export default function LoginExample() { 4 const { login, status, isLoading, error} = useLogin(); 5 6 async function handleLogin() { 7 try { 8 const response = await login({ 9 scope: 'email', 10 }); 11 12 console.log(response.status); 13 } catch (error: any) { 14 console.log(error.message); 15 } 16 } 17 18 return ( 19 <button onClick={handleLogin} disabled={isLoading}> 20 Login via Facebook 21 </button> 22 ); 23}
1import { FacebookProvider, LoginButton } from 'react-facebook'; 2 3export default function LoginButtonExample() { 4 functon handleSuccess(response) { 5 console.log(response.status); 6 } 7 8 function handleError(error) { 9 console.log(error); 10 } 11 12 return ( 13 <FacebookProvider appId="123456789"> 14 <LoginButton 15 scope="email" 16 onError={handleError} 17 onSuccess={handleSuccess} 18 > 19 Login via Facebook 20 </LoginButton> 21 </FacebookProvider> 22 ); 23}
1import { FacebookProvider, EmbeddedPost } from 'react-facebook'; 2 3export default function EmbeddedPostExample() { 4 return ( 5 <FacebookProvider appId="123456789"> 6 <EmbeddedPost href="http://www.facebook.com" width="500" /> 7 </FacebookProvider> 8 ); 9}
1import React, { Component} from 'react'; 2import { FacebookProvider, Page } from 'react-facebook'; 3 4export default class Example extends Component { 5 render() { 6 return ( 7 <FacebookProvider appId="123456789"> 8 <Page href="https://www.facebook.com" tabs="timeline" /> 9 </FacebookProvider> 10 ); 11 } 12}
1import React, { Component} from 'react'; 2import { FacebookProvider, Feed } from 'react-facebook'; 3 4export default class Example extends Component { 5 render() { 6 return ( 7 <FacebookProvider appId="123456789"> 8 <Feed link="https://www.facebook.com"> 9 {({ handleClick }) => ( 10 <button type="button" onClick={handleClick}>Share on Feed</button> 11 )} 12 </Feed> 13 </FacebookProvider> 14 ); 15 } 16}
1import React, { Component } from 'react'; 2import { FacebookProvider, Group } from 'react-facebook'; 3 4export default class Example extends Component { 5 render() { 6 return ( 7 <FacebookProvider appId="123456789"> 8 <Group 9 href="https://www.facebook.com/groups/375934682909754" 10 width="300" 11 showSocialContext={true} 12 showMetaData={true} 13 skin="light" 14 /> 15 </FacebookProvider> 16 ); 17 } 18}
1import React, { Component} from 'react'; 2import { FacebookProvider, MessageUs } from 'react-facebook'; 3 4export default class Example extends Component { 5 render() { 6 return ( 7 <FacebookProvider appId="123456789"> 8 <MessageUs messengerAppId="123456789" pageId="123456789"/> 9 </FacebookProvider> 10 ); 11 } 12}
1import React, { Component} from 'react'; 2import { FacebookProvider, SendToMessenger } from 'react-facebook'; 3 4export default class Example extends Component { 5 render() { 6 return ( 7 <FacebookProvider appId="123456789"> 8 <SendToMessenger messengerAppId="123456789" pageId="123456789"/> 9 </FacebookProvider> 10 ); 11 } 12}
1import React, { Component} from 'react'; 2import { FacebookProvider, MessengerCheckbox } from 'react-facebook'; 3 4export default class Example extends Component { 5 render() { 6 return ( 7 <FacebookProvider appId="123456789"> 8 <MessengerCheckbox messengerAppId="123456789" pageId="123456789"/> 9 </FacebookProvider> 10 ); 11 } 12}
1import React, { Component} from 'react'; 2import { FacebookProvider, CustomChat } from 'react-facebook'; 3 4export default class Example extends Component { 5 render() { 6 return ( 7 <FacebookProvider appId="123456789" chatSupport> 8 <CustomChat pageId="123456789" minimized={false}/> 9 </FacebookProvider> 10 ); 11 } 12}
1import { FacebookProvider, useFacebook } from 'react-facebook'; 2 3export default function UseFacebookExample() { 4 const { isLoading, init, error } = useFacebook(); 5 6 async function handleClick() { 7 const api = await init(); 8 9 const response = await api.login(); 10 const FB = await api.getFB(); // Get original FB object 11 } 12 13 return ( 14 <button disabled={isLoading} onClick={handleClick}> 15 Login 16 </button> 17 ); 18}
1import { FacebookProvider, useSubscribe } from 'react-facebook'; 2 3export default function UseSubscribeExample() { 4 const latestValue = useSubscribe('auth.statusChange', (value) => { 5 console.log('new response', value); 6 }); 7 8 return ( 9 <div> 10 {latestValue} 11 </div> 12 ); 13}
1import { FacebookProvider, useLoginStatus } from 'react-facebook'; 2 3export default function UseLoginStatusExample() { 4 const { status, isLoading, error } = useLoginStatus(); 5 6 return ( 7 <div> 8 Current user login status: {isLoading ? 'Loading...' : status} 9 </div> 10 ); 11}
This component will not sign user. You need to do that with another component. Default scope: 'id', 'first_name', 'last_name', 'middle_name', 'name', 'name_format', 'picture', 'short_name', 'email'. If profile is undefined login status !== LoginStatus.CONNECTED
1import { FacebookProvider, useProfile } from 'react-facebook'; 2 3export default function UseProfileExample() { 4 const { profile, isLoading, error } = useProfile(['id', 'name']); 5 6 return ( 7 <div> 8 {profile?.name} has id: {profile?.id} 9 </div> 10 ); 11}
1npx cypress open --component
Become my sponsor and help me maintain this project. Thank you
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More