A Component React for Facebook Login
npm install react-facebook-login-typed> Just a note: The repository is forked from an existing one (https://github.com/keppelen/react-facebook-login), but with upgraded code and types included (for typescript)
- yarn add react-facebook-login-typed or npm install react-facebook-login-typed
- Your application will also need react-dom and react installed.
js
import React, {useCallback} from 'react';
import FacebookLogin from 'react-facebook-login-typed'; const MyComponent = () => {
const responseFacebook = useCallback(() => {
console.log(response);
}, []);
return (
appId="1088597931155576"
autoLoad
callback={responseFacebook}
render={renderProps => (
)}
/>
);
};
`The
render function will be passed the following properties for you to use:-
onClick
- isDisabled
- isProcessing
- isSdkLoaded
$3
By default the component, request only 'public_profile' permission, you can change if you send 'scope', that is a string comma separated attribute.see https://developers.facebook.com/docs/facebook-login/permissions for permissions list
`js
import React, {useCallback} from 'react';
import FacebookLogin from 'react-facebook-login-typed'; const MyComponent = () => {
const responseFacebook = useCallback(() => {
console.log(response);
}, []);
return (
appId="1088597931155576"
autoLoad
fields="name,email,picture"
scope="public_profile,user_friends,user_actions.books"
callback={responseFacebook}
/>
);
};
`$3
`js
import React, {useCallback} from 'react';
import FacebookLogin from 'react-facebook-login-typed'; const MyComponent = () => {
const responseFacebook = useCallback(() => {
console.log(response);
}, []);
return (
appId="1088597931155576"
autoLoad
fields="name,email,picture"
callback={responseFacebook}
/>
);
};
``