Это видео недоступно.
Сожалеем об этом.

How to load Maps JavaScript API in React (2023)

Поделиться
HTML-код
  • Опубликовано: 14 авг 2024
  • Learn how to use the Maps JavaScript API in React. In this step-by-step tutorial, Leigh Halliday demonstrates how to get up and running with React and Google Maps Platform in 5 minutes. Watch how to use the new Google-sponsored, vis.gl managed library for React components and hooks that bring Google map elements and services into your web app.
    npm install @vis.gl/react-google-maps
    Chapters:
    0:00 - Intro
    0:32 - Installing the API
    1:34 - Installing the @vis.gl/react-google--maps package
    2:39 - Setting up a map ID
    3:14 - Adding markers
    4:18 - Adding info windows to markers
    6:02 - Wrap up
    Links:
    Source code → goo.gle/3FFYhKm
    Get an API Key → goo.gle/js-api...
    Get a Map ID → goo.gle/get-ma...
    Homepage for vis.gl/react-google-maps → goo.gle/47cOk38
    Watch more Geocasts → goo.gle/Geocasts
    Subscribe to Google Maps Platform → goo.gle/Google...
    #GoogleMapsPlatform #Geocasts

Комментарии • 63

  • @GoogleMapsPlatform
    @GoogleMapsPlatform  9 месяцев назад +5

    🙋 Do you have any questions about React or the API?
    Let us know below and subscribe for more Google Maps Platform tips → goo.gle/GoogleMapsPlatform

    • @zlackbiro
      @zlackbiro 8 месяцев назад

      Is this library free to use? If not, where to find pricing list?

  • @johnchen2963
    @johnchen2963 5 месяцев назад +11

    use defaultZoom and defaultCenter so you can drag and zoom instead of zoom and center props

    • @kashkamail4374
      @kashkamail4374 12 дней назад

      hey men, god bless you, you saved me, i've been loking this solution for an entire day, big kiss for you 😘😘

  • @akshatjain9281
    @akshatjain9281 5 месяцев назад +7

    does it work with latest react?
    because i am having the peer dependency issue

  • @user-rq8ky5oi5z
    @user-rq8ky5oi5z 6 месяцев назад +2

    Thank you ! Very nice and simple explanation.

  • @hussamshannan6604
    @hussamshannan6604 Месяц назад

    This is very helpful ♥️thank you 🙏🏾

  • @tengineer1453
    @tengineer1453 Месяц назад

    hello, how can i take screenhot to maps without the other elements, for example; drawing manager or tilt setting button, i want to take just maps image like i done with mapbox.getcanvas function

  • @GatoNordico
    @GatoNordico 9 месяцев назад

    This is great news! Keep them videos coming, really curious what this library will allow… in the meantime I’ll spend some time reading the docs 🙏🏻

  • @frontend_ko
    @frontend_ko 5 месяцев назад

    okay, thanks for nice tutorial and helpful comments

  • @capmajo334
    @capmajo334 4 месяца назад +2

    It wasnt allowing me to move in any direction or to zoom in or out. To do this, you have to use defaultZoom and defaultCenter. If not, the map will be in a fixed position.

    • @cpn1011
      @cpn1011 4 месяца назад +1

      can i ask you how? i have the issues you told.

    • @capmajo334
      @capmajo334 4 месяца назад

      @@cpn1011 instead of using the property zoom={9} use defaultZoom={9}, same goes for center

    • @cpn1011
      @cpn1011 4 месяца назад +1

      Thank you:) eventually i solved the issue from your saying.

  • @juju_be
    @juju_be 18 дней назад

    instead of zoom and center, use defaultZoom and defaultCenter. Otherwise you cant zoom or drag around the map.

  • @nathanvanzandt9265
    @nathanvanzandt9265 Месяц назад

    Is there a way to make the map responsive to screen height or width changes? I tried width: 100% and it does not work

  • @phongngo315
    @phongngo315 4 месяца назад

    Hello.
    I'm using const places = useMapsLibrary("places") to implement autocomplete. But it doesn't work, the variable places always null. please help me

  • @muhamadbayu4955
    @muhamadbayu4955 5 месяцев назад

    how can i show the maps, is it next start? but it says:
    next : The term 'next' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
    a path was included, verify that the path is correct and try again.
    At line:1 char:1
    + next start
    + ~~~~
    + CategoryInfo : ObjectNotFound: (next:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

  • @siobe0
    @siobe0 9 месяцев назад

    Is the info window style-able or do we have to implement a custom component for that?
    edit for anyone with the same question:
    The InfoWindow component in this library is using the google.maps.InfoWindow class under the hood so your application cannot fully control the styling of the window or the close button.
    I've tried to implement a dark mode in the past and ran into issues with styling the google.maps.InfoWindow class for which my workaround was to extend the CustomOverlay class to implement a "custom info window" - not sure if there's a better solution for this now as this was 2 yrs ago but definitely seems like it should be part of this new library.

    • @GoogleMapsPlatform
      @GoogleMapsPlatform  9 месяцев назад

      Thanks for raising this on GitHub! Others interested in custom info window support, chime in on this issue: github.com/visgl/react-google-maps/issues/83

  • @SamBattis
    @SamBattis 8 месяцев назад

    How can you load the broader Google Maps Javascript API in React so outside of tags, features such as google.maps. elements can be used? I have not been able to find any documentation for this.

  • @JonnyOrtiz-wu8ii
    @JonnyOrtiz-wu8ii 6 месяцев назад +2

    Unable to pan the map left, right, up or down

    • @yungrut6553
      @yungrut6553 3 месяца назад

      defaultCenter and defaultZoom not center and zoom

  • @marouaguentiti8328
    @marouaguentiti8328 4 месяца назад

    How can I just display the map of a specific country?

  • @justin9494
    @justin9494 5 месяцев назад

    How do I integrate places autocomplete with this?

  • @paulopma
    @paulopma 7 месяцев назад

    Do you have some example using Pegman (the yellow man for street view hahaha)?

  • @334gabriel
    @334gabriel 3 месяца назад

    How did you create that theme?

  • @ecpefkeh5986
    @ecpefkeh5986 8 месяцев назад

    can you make more videos for this library please

  • @paulopma
    @paulopma 7 месяцев назад

    The npm page says it's still in alpha. Isn't it safe for production yet?

  • @No-zk5xn
    @No-zk5xn 9 месяцев назад

    what should be the type of map id in the typescript ? the key is output to the console, and id undefined

    • @No-zk5xn
      @No-zk5xn 9 месяцев назад

      error in console The map is initialized without a valid Map ID, which will prevent use of Advanced Markers.

    • @No-zk5xn
      @No-zk5xn 9 месяцев назад

      when i use type string

  • @zkcll5574
    @zkcll5574 8 месяцев назад

    Are those '&&' in line 28 at last moment?

  • @qualion
    @qualion 9 месяцев назад

    Anyone knows how to implement marker clustering with this new library?

    • @GoogleMapsPlatform
      @GoogleMapsPlatform  8 месяцев назад +1

      We've added a Marker Clustering sample to visgl.github.io/react-google-maps/examples with source code at github.com/visgl/react-google-maps/tree/main/examples/marker-clustering

  • @shinpaingmin603
    @shinpaingmin603 8 месяцев назад +1

    Is it totoally free? Do I need to give credit card information?

    • @GoogleMapsPlatform
      @GoogleMapsPlatform  8 месяцев назад +1

      You can learn more about billing and credits for use of the Maps JavaScript API at developers.google.com/maps/documentation/javascript/usage-and-billing

  • @Veera8124_
    @Veera8124_ 9 месяцев назад

    can i only show the africa map using javascript and react.

  • @juani_gauna
    @juani_gauna 9 месяцев назад

    i couldn't find the library what you use for the ApiProvider component

    • @GoogleMapsPlatform
      @GoogleMapsPlatform  9 месяцев назад

      It comes from the line that imports the @vis.gl/react-google-maps library:
      import { APIProvider } from "@vis.gl/react-google-maps";

  • @VinayTandale
    @VinayTandale 4 месяца назад

    Please correct the video by changing the Map props from zoom and center to Default zoom and defaultcenter

  • @GeniusBrilliant
    @GeniusBrilliant 7 месяцев назад

    is it an official google team channel and library? or just a channel who really good pretend to be?

  • @user-fr6vj1ig3x
    @user-fr6vj1ig3x 8 месяцев назад

    Doesn't it support mobile? The map looks very bad on mobile.

  • @dannyisrael
    @dannyisrael 9 месяцев назад +1

    doesn’t this make the google maps api key public?

    • @leighhalliday
      @leighhalliday 9 месяцев назад +2

      Yes Danny! Yes, it does, and it has to be public to use maps... but that's no problem because Google provides a way to add restrictions for your API Key. You can restrict it to the Web, to specific APIs, and you can restrict it to your website only... so if someone copies it and tries to use it on their website, it won't work. You should definitely add the appropriate restrictions any time you're using an API Key from Google.

    • @GoogleMapsPlatform
      @GoogleMapsPlatform  9 месяцев назад +1

      Here's a video on restricting your API key: ruclips.net/video/2_HZObVbe-g/видео.htmlsi=J9HCo0znWLhW3WST&t=87 and detailed recommendations at developers.google.com/maps/api-security-best-practices

  • @mohammedabujayyab6146
    @mohammedabujayyab6146 3 месяца назад

    zooming by mouse not working!

  • @rubiadias7677
    @rubiadias7677 9 месяцев назад

    Gracias o/

  • @godriceeichie
    @godriceeichie 6 месяцев назад

    I'm I the only that could not install the package because of the splitting error showing on the terminal

    • @ene_andre
      @ene_andre 6 месяцев назад +1

      you'll be able to install it just fine in your command prompt not via vs code terminal

    • @godriceeichie
      @godriceeichie 6 месяцев назад

      @@ene_andre okay thanks

    • @Vandana_pawar
      @Vandana_pawar Месяц назад

      @@ene_andre but it doesnt shows their files in vscode

    • @ene_andre
      @ene_andre Месяц назад

      @@Vandana_pawar Hi, it worked for me tho, maybe ensure you are installing the package from your cmd in the exact project path you are working on

  • @JonnyOrtiz-wu8ii
    @JonnyOrtiz-wu8ii 6 месяцев назад

    Zoom doesn't work, map won't zoom in or out

    • @JonnyOrtiz-wu8ii
      @JonnyOrtiz-wu8ii 6 месяцев назад +1

      nevermind, just fixed this by changing zoom props to defaultZoom

  • @md.abuhanifa9843
    @md.abuhanifa9843 6 месяцев назад

    ❤️❤️💚💚🇧🇩🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲💛💛💛💛💛💛💛💛💛💛💛💛💛🤲💯💯Thanks a Lot my honourable lovely all of my Soulful & faithful friends. Again,Thank you.❤️❤️💚💚🇧🇩🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲🤲💯