Skip to content

Commit 936cf4b

Browse files
committed
update readme with apiKey prop example
1 parent ba9da92 commit 936cf4b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@
66

77
`npm i react-google-autocomplete --save`
88

9-
You also have to include google autocomplete link api in your app. Somewhere in index.html or somwhere else.
9+
<hr>
10+
11+
As of version 1.2.4, you can now pass an `apiKey` prop to automatically load the Google maps scripts. The api key can be found in your [google cloud console.](https://developers.google.com/maps/documentation/javascript/get-api-key)
12+
13+
```js
14+
<AutoComplete
15+
apiKey={YOUR_GOOGLE_MAPS_API_KEY}
16+
onPlaceSelected={() => 'do something on select'}
17+
/>
18+
```
19+
20+
Alternatively if not passing the `apiKey` prop, you can include google autocomplete link api in your app. Somewhere in index.html or somewhere else.
1021

1122
```html
1223
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=[YOUR_API_KEY]&libraries=places"></script>

0 commit comments

Comments
 (0)