
Research
wget to Wipeout: Malicious Go Modules Fetch Destructive Payload
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
google-places-autocomplete-react
Advanced tools
A lightweight React component for Google Places autocomplete.
A lightweight and easy-to-use Google Places Autocomplete component for React applications. It allows users to search for locations and fetch place details using the Google Places API.
Install the package using npm or yarn:
npm install google-places-autocomplete-react
OR
yarn add google-places-autocomplete-react
import React from "react";
import GooglePlacesAutocomplete from "google-places-autocomplete-react";
const App = () => {
const handlePlaceSelect = (place) => {
console.log("Selected Place:", place);
};
return (
<div style={{ maxWidth: "400px", margin: "50px auto" }}>
<GooglePlacesAutocomplete
apiKey="YOUR_GOOGLE_API_KEY"
onPlaceSelect={handlePlaceSelect}
/>
</div>
);
};
export default App;
The onPlaceSelect
callback receives an object containing:
description
- The name of the selected place.lat
- Latitude of the location.lng
- Longitude of the location.Example:
const handlePlaceSelect = (place) => {
console.log("Place Name:", place.description);
console.log("Latitude:", place.lat);
console.log("Longitude:", place.lng);
};
<GooglePlacesAutocomplete
apiKey="YOUR_GOOGLE_API_KEY"
onPlaceSelect={handlePlaceSelect}
placeholder="Enter a city or address"
/>
This component allows full customization via props.
<GooglePlacesAutocomplete
apiKey="YOUR_GOOGLE_API_KEY"
onPlaceSelect={handlePlaceSelect}
inputClassName="custom-input"
suggestionsClassName="custom-suggestions"
suggestionItemClassName="custom-suggestion-item"
inputStyle={{ padding: "10px", fontSize: "16px" }}
suggestionsStyle={{ backgroundColor: "white", borderRadius: "5px" }}
suggestionItemStyle={{ padding: "8px", cursor: "pointer" }}
/>
Prop Name | Type | Required | Description |
---|---|---|---|
apiKey | string | β Yes | Your Google Maps API key. |
onPlaceSelect | function | β Yes | Callback function triggered when a place is selected. |
placeholder | string | β No | Placeholder text for the input field (default: "Search for a location"). |
inputClassName | string | β No | Custom class name for the input field. |
suggestionsClassName | string | β No | Custom class name for the suggestions dropdown. |
suggestionItemClassName | string | β No | Custom class name for each suggestion item. |
inputStyle | object | β No | Inline styles for the input field. |
suggestionsStyle | object | β No | Inline styles for the suggestions container. |
suggestionItemStyle | object | β No | Inline styles for suggestion items. |
To use this package, you need a Google API key with the Places API enabled.
apiKey
prop.β Ensure:
β Check your Google Cloud billing settings. Google provides free tier limits for Places API usage.
β Make sure:
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! If youβd like to improve this package:
git checkout -b feature-name
.git commit -m "Added feature XYZ"
.git push origin feature-name
.If you encounter any issues or have suggestions, feel free to:
Happy coding! π
FAQs
A lightweight React component for Google Places autocomplete.
The npm package google-places-autocomplete-react receives a total of 43 weekly downloads. As such, google-places-autocomplete-react popularity was classified as not popular.
We found that google-places-autocomplete-react demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.
Product
We redesigned Socket's first logged-in page to display rich and insightful visualizations about your repositories protected against supply chain threats.