DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
ReneKutter
ReneKutter

Posted on

How to run Google Maps API in React 18 ?

Hi guys, I've been trying to get a new React project running with the Google Maps API (https://www.npmjs.com/package/google-map-react) for several hours now. Can someone help me?
!
Image description

Top comments (3)

Collapse
 
brense profile image
Rense Bakker

Are you sure you need that library? It's for a pretty specific use-case, rendering your own React components on a google map.

If you want to use the google maps API in a React application: developers.google.com/maps/documen...

Collapse
 
renekutter profile image
ReneKutter Author

I would like to use the library I mentioned because it is used in every tutorial on YouTube. This is important to me because I'm just beginning to learn ReactJS. Alternatively, I would also use React 17, I just need a working installation to learn.

Collapse
 
brense profile image
Rense Bakker

Here's a video tutorial on how to use the Google Maps React API:
youtube.com/watch?v=9e-5QHpadi0

Don't worry too much about the differences between React 17 and React 18. For a beginner, there arent really any except for the way in which you render your application:

// React 17
ReactDOM.render(<App />, document.getElementById('root'))

// React 18
ReactDOM.createRoot(document.getElementById('root')!).render(<App />)
Enter fullscreen mode Exit fullscreen mode

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.