
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
google-maps-hooks
Advanced tools
A library of hooks to integrate your React App with 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
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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.