0.1.2 • Published 3 years ago
use-gsi v0.1.2
useGSI
Introduction
A tiny React hook that simplifies the process of using the Google Identity Service in a React application
Install
npm
npm install use-gsiyarn
yarn add use-gsiQuick Start
Auto initilized google button
Get your Google API client ID
import React from "react";
import { useGSI } from "use-gsi";
export default function App() {
  const [data, setData] = useState({});
  const { buttonRef } = useGSI({
    initializeConfig: {
      //Google API client ID
      client_id: clientId,
      callback: (response) => setData(response),
    },
    method: "renderButton",
    buttonConfig: {
      theme: "outline",
      type: "standard",
    },
  });
  console.log(data);
  return <div ref={buttonRef} />;
}Options
// TODO
License
The MIT License.