Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cristiandley readme libraries section #287

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,35 @@ All components are available on the top-level export.
import { GoogleMap, Marker, SearchBox } from "react-google-maps";
```

### Loading Libraries

To use this component, you are going to need to load the [Google Maps Javascript API].
It is optional, but recommended, to specify the libraries you will be using as well as your API key.

You could do it synchronously like so:

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

```js
<GoogleMapLoader
query={{ libraries: "geometry,drawing,places,visualization" }}
...
```

Or asynchronously using the ScriptjsLoader:

```js
<ScriptjsLoader
hostname={"maps.googleapis.com"}
pathname={"/maps/api/js"}
query={{ key: "[YOUR_API_KEY]", libraries: "geometry,drawing,places" }}
...
```

### Trigger events

`triggerEvent(component, ...args)`: One common event trigger is to resize map after the size of the container div change.
Expand Down Expand Up @@ -212,3 +241,5 @@ Then open [http://localhost:8080/webpack-dev-server/](http://localhost:8080/webp
[examples_gh_pages]: https://github.com/tomchentw/react-google-maps/tree/master/examples/gh-pages
[webpack]: http://webpack.github.io/docs/tutorials/getting-started/
[conventional-changelog]: https://github.com/ajoslin/conventional-changelog

[Google Maps Javascript API]: https://developers.google.com/maps/documentation/javascript/