Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
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
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.