npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@greatsumini/react-facebook-login

v3.3.3

Published

Well-typed React Component for Facebook Login

Downloads

75,672

Readme

React Facebook Login

NPM version NPM downloads NPM bundle size CI CD GitHub Stars

React Component for Facebook Login. aims to improve react-facebook-login. 한글 가이드

  • 💙 Typescript support
  • 📦 6kb mini library
  • 👫 All browsers supported
  • 🏃 Currently maintaining

Table of contents

Getting Started

npm i --save @greatsumini/react-facebook-login
# or
yarn add @greatsumini/react-facebook-login

Usage

Component

import FacebookLogin from '@greatsumini/react-facebook-login';

// default
<FacebookLogin
  appId="1088597931155576"
  onSuccess={(response) => {
    console.log('Login Success!', response);
  }}
  onFail={(error) => {
    console.log('Login Failed!', error);
  }}
  onProfileSuccess={(response) => {
    console.log('Get Profile Success!', response);
  }}
/>

// custom style
<FacebookLogin
  appId="1088597931155576"
  style={{
    backgroundColor: '#4267b2',
    color: '#fff',
    fontSize: '16px',
    padding: '12px 24px',
    border: 'none',
    borderRadius: '4px',
  }}
/>

// custom render function
<FacebookLogin
  appId="1088597931155576"
  onSuccess={(response) => {
    console.log('Login Success!', response);
  }}
  onFail={(error) => {
    console.log('Login Failed!', error);
  }}
  onProfileSuccess={(response) => {
    console.log('Get Profile Success!', response);
  }}
  render={({ onClick, logout }) => (
    <CustomComponent onClick={onClick} onLogoutClick={logout} />
  )}
/>

// custom params, options
<FacebookLogin
  appId="1088597931155576"
  useRedirect
  initParams={{
    version: 'v10.0',
    xfbml: true,
  }}
  dialogParams={{
    response_type: 'token',
  }}
  loginOptions={{
    return_scopes: true,
  }}
/>

FacebookLoginClient

You can manually call facebook sdk related functions with FacebookLoginClient

import { FacebookLoginClient } from '@greatsumini/react-facebook-login';

FacebookLoginClient.getLoginStatus((res) => {
  console.log(res.status);
});

FacebookLoginClient.login((res) => {
  console.log(res);
});

FacebookLoginClient.getProfile((res) => {
  console.log(res.id, res.name, res.email);
});

FacebookLoginClient.logout(() => {
  console.log('logout completed!');
});

Examples

You can checkout examples here

Props

Check all available params,options here

| Property | Description | Type | Default | | ---------------- | ------------------------------------------------ | --------------------------- | ------------------------------------------------------------------------------------------------------------- | | appId * | Your application ID. | string | - | | language | API version | string | 'en_US' | | scope | Comma seperated list of permissions for login. | string | 'public_profile, email' | | fields | fields return by /me (profile) | string | 'name,email,picture' | | onSuccess | | function | - | | onFail | | function | - | | onProfileSuccess | | function | - | | style | css properties for login button | CSSProperties | - | | children | Children Component | ReactNode | ReactNodeArray | "Login with Facebook" | | render | Callback which render custom component | function | - | | autoLoad | if true, request login on mount | boolean | false | | useRedirect | if true, use redirect instead of window.FB.login | boolean | false (forced to be true in fb browers (ref)) | | useCustomChat | if true, append 'xfbml.customerchat' to sdk url | boolean | false | | initParams | params for FB.init | InitParams | docs | | dialogParams | params for login dialog | DialogParams | docs | | loginOptions | options for FB.login | LoginOptions | docs |

Stay in touch

License

React Facebook Login is MIT licensed.

Links