Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

login with facebook in react

// import book from '../../assets/images/facebook.png'
import './assets/css/all.css'
import './assets/css/bootstrap.min.css'
import './assets/css/responsive.css'
import './assets/css/style.css'
import React, { useState } from "react";
import FacebookLogin from "react-facebook-login/dist/facebook-login-render-props";
const book = require("./assets/images/facebook.png")
//import ReactDOM from "react-dom";
const responseFacebook = (response) => {
  console.log(response);
};
const FacebookLoginPage = () => {
  
  const [showLoginButton, setLoginButton] = useState(true);
  const [showLogoutButton, setLogoutButton] = useState(false);
  const loginHandler = (res) => {
    console.log("res", res.profileObj);
    setLoginButton(false);
    setLogoutButton(true);
  };
  const failureHandler = (res) => {
    console.log("login failed", res);
  };
  const logoutHandler = (res) => {
    alert("logout sucessfully");
    setLoginButton(true);
    setLogoutButton(false);
  };
  return (
    <>
      {showLoginButton && (
        <FacebookLogin
          appId="240813111599696"
          callback={responseFacebook}
          render={(renderProps) => (
            <button
              className="btn button btn-outline"
              onClick={renderProps.onClick}
            >  
                  <img src={book} />  Sign up with Facebook
            </button>
            
            )}
            />
            )}
           
    </>
  );
};
export default FacebookLoginPage;
Comment

react facebook login

import FacebookLogin from 'react-facebook-login/dist/facebook-login-render-props'
Comment

login with facebook in react

// import book from '../../assets/images/facebook.png'
import './assets/css/all.css'
import './assets/css/bootstrap.min.css'
import './assets/css/responsive.css'
import './assets/css/style.css'
import React, { useState } from "react";
import FacebookLogin from "react-facebook-login/dist/facebook-login-render-props";
const book = require("./assets/images/facebook.png")
//import ReactDOM from "react-dom";
const responseFacebook = (response) => {
  console.log(response);
};
const FacebookLoginPage = () => {
  
  const [showLoginButton, setLoginButton] = useState(true);
  const [showLogoutButton, setLogoutButton] = useState(false);
  const loginHandler = (res) => {
    console.log("res", res.profileObj);
    setLoginButton(false);
    setLogoutButton(true);
  };
  const failureHandler = (res) => {
    console.log("login failed", res);
  };
  const logoutHandler = (res) => {
    alert("logout sucessfully");
    setLoginButton(true);
    setLogoutButton(false);
  };
  return (
    <>
      {showLoginButton && (
        <FacebookLogin
          appId="240813111599696"
          callback={responseFacebook}
          render={(renderProps) => (
            <button
              className="btn button btn-outline"
              onClick={renderProps.onClick}
            >  
                  <img src={book} />  Sign up with Facebook
            </button>
            
            )}
            />
            )}
           
    </>
  );
};
export default FacebookLoginPage;
Comment

react facebook login

import FacebookLogin from 'react-facebook-login/dist/facebook-login-render-props'
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript get clock time in auto counter up 
Javascript :: node js require file in parent directory 
Javascript :: jsonb_set 
Javascript :: nodejs http 
Javascript :: react select error handle 
Javascript :: fibonacci numbers 
Javascript :: big o notation javascript 
Javascript :: js is variable int 
Javascript :: maximum number in javascript 
Javascript :: show modal by using id in list react 
Javascript :: javascript clone object 
Javascript :: template literal syntax 
Javascript :: how to sum the array values in javascript 
Javascript :: Javascript Event Loop 
Javascript :: new date 
Javascript :: how to give custom name to collection in mongoose 
Javascript :: javascript print to console 
Javascript :: jquery bootstrap checkbox val 
Javascript :: vue css 
Javascript :: trigger click on first row datatable jquery 
Javascript :: nuxtjs loading 
Javascript :: js exclude from object 
Javascript :: npm paypal express checkout 
Javascript :: Check if instance is array 
Javascript :: Error: Node Sass version 5.0.0 is incompatible with ^4.0.0 
Javascript :: react native list view 
Javascript :: Sort() functions 
Javascript :: threejs perspectivecamera 
Javascript :: d3js.org 
Javascript :: how to add an event listener to a function javascript 
ADD CONTENT
Topic
Content
Source link
Name
2+4 =