
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
use-google-places
Advanced tools
React hook that consumes Google Places API returning both autocomplete and geocoding callback method
Hook to consume Google Places API returning both autocomplete with debounce and geocoding callback method
onChange<keyword> -> Fetch autocomplete -> results -> onSelect -> Fetch geocoding -> onSelect.callback<result>
Prop | Description | Default |
---|---|---|
apiKey | Client-side google api key (documentation)[https://developers.google.com/places/web-service/get-api-key]. | None |
delay | debounce OnChange (milliseconds). | 0 |
Prop | Description | Type |
---|---|---|
loading | Triggers each request. | boolean |
results | Normalized Google API (predictions)[https://developers.google.com/places/web-service/autocomplete#place_autocomplete_responses]. | {title, subtitle, placeId, description} |
onChange | Function that triggers autocomplete. | function<string> |
onSelect | Optional function that triggers geocoding executing a callback with coordinates and details. | function<{placeId}, callback<geocoding-payload> |
const { loading, results, onChange, onSelect } = useGooglePlaces({
apiKey: 'my-google-api-key',
delay: 400,
});
...
const onPress = item => {
onSelect(item, ({ coordinates }) => {
dispatch({
type: SET_LOCATION,
payload: coordinates,
});
});
};
...
<FlatList
data={results}
renderItem={({ item }) => (
<LocationItem
title={item.title}
subtitle={item.subtitle}
onPress={onPress}
/>
)}
/>
FAQs
React hook that consumes Google Places API returning both autocomplete and geocoding callback method
The npm package use-google-places receives a total of 0 weekly downloads. As such, use-google-places popularity was classified as not popular.
We found that use-google-places 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
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.