0.1.2 • Published 1 year ago

use-gsi v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

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-gsi

yarn

yarn add use-gsi

Quick 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.