Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lourd/react-google-api

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lourd/react-google-api

Google's REST APIs browser client as a declarative React component

  • 0.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
62
decreased by-36.73%
Maintainers
1
Weekly downloads
 
Created
Source

@lourd/react-google-api npm package badge Build status

Integrate your React application with one of Google's many APIs with the GoogleApi component.

This component handles setting up Google's JavaScript API client library and making its state available to the rest of the React component tree through context and a render prop.

See @lourd/react-google-sheet for an example of using the component.

Installation

yarn add @lourd/react-google-api

Browser

Available as a simple <script> through unpkg.com. The module will be available as the global variable ReactGoogleApi.

Development
<script src="https://unpkg.com/react/umd/react.development.js" type="text/javascript></script>
<script src="https://unpkg.com/@lourd/react-google-api/dist/index.umd.js" type="text/javascript></script>
Production
<script src="https://unpkg.com/react/umd/react.production.min.js" type="text/javascript></script>
<script src="https://unpkg.com/@lourd/react-google-api/dist/index.umd.min.js" type="text/javascript></script>

Reference

import { GoogleApi, GoogleApiConsumer } from '@lourd/react-google-api'

ApiState interface

interface ApiState {
  loading: boolean;
  signedIn: boolean;
  client?: gapi.client; // https://developers.google.com/api-client-library/javascript/reference/referencedocs#client-setup,
  error?: Error;
  authorize: Function;
  signout: Function;
}

<GoogleApi/>

PropertyTypeRequired
clientIdstringyes
apiKeystringyes
discoveryDocs[string]yes
scopes[string]yes
childrenFunction(api: ApiState): PropTypes.node or PropTypes.nodeyes

Get an API key and client ID from the Google APIs console. Learn more about the discovery docs and scopes concepts from Google's reference material.

<GoogleApiConsumer/>

This component gives access to the Google API state passed down by a GoogleApi component. It uses its children prop as a function to pass the arguments along. There must be an ancestor GoogleApi rendered in the component tree for this component to work.

PropertyTypeRequired
childrenFunction<ApiState>yes

Keywords

FAQs

Package last updated on 27 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc