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

doc: Update get-started.md #510

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions docs/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,39 @@ root.render(
</React.StrictMode>
);
```

## Development Setup
If you are using @vis.gl/react-google-maps for development purposes and do not need to access Google Maps services during testing, you can simplify your setup by using an empty string for the apiKey. This allows you to bypass the need for a valid API key, making it easier to start working with the library without worrying about API quotas or obtaining a key.

To use this setup, create a .env file in your project directory with the following content:

```text title=".env"
GOOGLE_MAPS_API_KEY=""
```

This setup will allow you to run the examples or your own application without requiring an actual API key. Keep in mind that certain Google Maps features will not be available with an empty API key, so this configuration is only recommended for development and testing purposes.

```tsx title=index.jsx
import React from 'react';
import {createRoot} from 'react-dom/client';
import {APIProvider, Map} from '@vis.gl/react-google-maps';

const App = () => (
<APIProvider apiKey="">
<Map
style={{width: '100vw', height: '100vh'}}
defaultCenter={{lat: 22.54992, lng: 0}}
defaultZoom={3}
gestureHandling={'greedy'}
disableDefaultUI={true}
/>
</APIProvider>
);

const root = createRoot(document.querySelector('#app'));
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
```