https://github.com/emreramazanoglu72/use-google-places-autocomplete
Google Places Autocomplete API'sini kullanarak yer arama ve öneri özelliği sağlayan bir React Hook projesi.
https://github.com/emreramazanoglu72/use-google-places-autocomplete
google googlemaps javascript next nextjs places-api places-autocomplete react reacthooks reactjs
Last synced: about 2 months ago
JSON representation
Google Places Autocomplete API'sini kullanarak yer arama ve öneri özelliği sağlayan bir React Hook projesi.
- Host: GitHub
- URL: https://github.com/emreramazanoglu72/use-google-places-autocomplete
- Owner: emreramazanoglu72
- Created: 2023-06-20T17:09:08.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-06-22T06:20:24.000Z (almost 3 years ago)
- Last Synced: 2025-10-21T18:44:51.503Z (7 months ago)
- Topics: google, googlemaps, javascript, next, nextjs, places-api, places-autocomplete, react, reacthooks, reactjs
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/use-google-places-autocomplete
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# use-google-places-autocomplete
A custom React hook for integrating Google Places Autocomplete into your application.
## Installation
Install the package using npm:
```shell
npm install use-google-places-autocomplete
```
OR
Install the package using yarn:
```shell
yarn add use-google-places-autocomplete
```
## Usage
```shell
import useGooglePlacesAutocomplete from 'use-google-places-autocomplete';
const options = {
// Autocomplete options
};
const apiKey = 'YOUR-GOOGLE-MAPS-API-KEY';
const YourComponent = () => {
const { autoCompleteRef, inputRef, place } = useGooglePlacesAutocomplete(apiKey, options);
// Use the autoCompleteRef, inputRef, and place values in your component
return (
);
};
```
## API
### `useGooglePlacesAutocomplete(apiKey, options)`
The `useGooglePlacesAutocomplete` hook accepts two parameters:
- `options` (object): Options for the Autocomplete instance.
- `apiKey` (string): Google Maps API key.
The hook returns an object containing the following properties:
- `autoCompleteRef` (object): A ref that can be attached to the input element to enable Autocomplete functionality.
- `inputRef` (object): A ref that references the input element.
- `place` (object): The selected place object returned by the Autocomplete service.
## License
This script is licensed under the MIT License.