@slorber/react-google-maps
Version:
React.js Google Maps API integration
39 lines (32 loc) • 815 B
Markdown
add @react-google-maps/api
```
The two basic components required to use this library are:
* LoadScript - Loads the Google Maps API script
* GoogleMap - The map component inside which all other components render
```js static
import React, { Component } from 'react'
import { GoogleMap, LoadScript } from '@react-google-maps/api'
class MyComponents extends Component {
render() {
return (
<LoadScript
id="script-loader"
googleMapsApiKey="YOUR_API_KEY"
{...other props}
>
<GoogleMap
id='example-map'
{...other props }
>
...Your map components
</GoogleMap>
</LoadScript>
)
}
}
```
```bash
npm install --save @react-google-maps/api
yarn