
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
google-maps-hooks
Advanced tools
_Google Maps Hooks_ is a utility library that exposes various React hooks that interact with the official Google Maps API.
Google Maps Hooks is a utility library that exposes various React hooks that interact with the official Google Maps API.
With Yarn:
yarn add google-maps-hooks
With NPM:
npm install --save google-maps-hooks
See: https://developers.google.com/maps/gmp-get-started#create-project
useGeocoding
useDirections
useDistanceMatrix
useGeolocation
useElevation
usePlaces
usePlayableLocations
useRoads
useSemanticTile
useStreetView
useTimeZone
GMapsProvider
Firstly, wrap your root component (normally App
) with GMapsProvider
and pass it your Google Maps API Key.
import GMapsProvider from "google-maps-hooks";
const App = () => {
...
};
const Root = () => (
<GMapsProvider apiKey={YOUR_GOOGLE_MAPS_API_KEY}>
<App />
</GMapsProvider>
);
export default Root;
And that's it! You can now call any of the available hooks from anywhere in your application.
import React, { useEffect } from "react";
import GMapsProvider, { useGeocoding } from "google-maps-hooks";
const App = () => {
const geocoding = useGeocoding();
useEffect(() => {
geocoding.geocode("My home address").then((res) => console.log(res));
}, [geocoding]);
return <p>Example</p>;
};
const Root = () => (
<GMapsProvider apiKey="AIzaSyAYjk3uc084G9YRkMfSbbfhA0atGZmbh_8">
<App />
</GMapsProvider>
);
export default Root;
GMapsProvider
Name | Type | Required | Default value |
---|---|---|---|
apiKey | string | Yes | None |
children | ReactNode | No | None |
useGeocoding
None
An object containing only one method: geocode
.
geocode
takes an address (string
) as its first argument and returns a Promise
that resolves to an object containing the geocoded data.
FAQs
A library of hooks to integrate your React App with Google Maps API
The npm package google-maps-hooks receives a total of 4 weekly downloads. As such, google-maps-hooks popularity was classified as not popular.
We found that google-maps-hooks demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.