Google Places - Autocomplete in React

Поділитися
Вставка
  • Опубліковано 1 гру 2024

КОМЕНТАРІ •

  • @itzvaleska9657
    @itzvaleska9657 10 місяців тому +2

    Man you a life saver.. thanks 4 yrs later

  • @durbslife
    @durbslife 5 років тому +20

    LOL the disappointment when you found the error to be an extra '#' sign. That is real life programming right there! Great vid!

    • @leighhalliday
      @leighhalliday  5 років тому +1

      Haha thanks! The sad part is that I usually do this once before actually recording... Still tons of errors even on the second go :D

    • @nils8752
      @nils8752 4 роки тому

      @@leighhalliday I wrote a state and context file the other day without checking for errors until after I was finished. And as expected webloader threw a couple of errors after I was done but none of them were in the code I wrote. I searched for hours until I realized that somehow autocomplete and a bunch of unlucky keystrokes put a import express from 'express' at the beginning of my state file and I never thought of checking the top for errors. I was so disappointed with myself that I called it a day and went to bed :D

  • @moonstanley2320
    @moonstanley2320 4 роки тому +11

    That was dope. This was the most simple and 'get-to-the-point' tutorial I've seen regarding maps. Thanks!

    • @leighhalliday
      @leighhalliday  4 роки тому

      Thanks Moon, glad you enjoyed the video :)

  • @yashjain9863
    @yashjain9863 3 роки тому

    thanks, bro!!!!!
    Really helped a lot
    It was the OPT explanation for The Problem
    Perfect Video for React Integration with Google Places API

  • @ryan.connaughton
    @ryan.connaughton 3 роки тому

    Thanks for the vid! I spotted the hash mistake soon as you written it and I was playing pantomime at my screen cheering you on to find it!

    • @leighhalliday
      @leighhalliday  3 роки тому +2

      Haha... I try to keep the development "real"... mistakes and all.

  • @dhs0113
    @dhs0113 4 роки тому +1

    I'm quite newbie to javascript and react. Currently I'm working on a project, and this helped me a lot and saved massive time for developing. Really appreciated! :)

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      Sweet, welcome to the JS/React community :) Glad the video was able to help!

  • @cesaralexanderarevalo6647
    @cesaralexanderarevalo6647 3 роки тому

    Thanks Bro. You saved me. New subscriber from Colombia.

    • @leighhalliday
      @leighhalliday  3 роки тому +1

      Gracias Cesar! Un saludo desde Canadá! Cuidate mucho porque en este momento la situacion en Colombia esta brava!

    • @cesaralexanderarevalo6647
      @cesaralexanderarevalo6647 3 роки тому

      @@leighhalliday Que buen Español Hermano. Gracias, aquí seguiremos luchando de la mejor forma posible por conseguir un mejor país.

  • @TheYakMaster408
    @TheYakMaster408 3 роки тому

    Respect brotha. Thanks for taking the time to make this easy and painless by removing the pain points for initial setup!

  • @AbirBinAyubKhan
    @AbirBinAyubKhan 4 роки тому

    Thanks. Helped me integrate the Places Api to my project. Keep posting the great stuff.

    • @leighhalliday
      @leighhalliday  4 роки тому

      Nice!! Happy I could help, Abir. Thanks for saying hi!

  • @ThreeMTG
    @ThreeMTG 4 роки тому

    Thanks for the vids, man! I just watched the Maps API video of yours and it was really helpful.

    • @leighhalliday
      @leighhalliday  3 роки тому +1

      Nice, glad you enjoyed it Ivani, thank you!

  • @emersonaraujo406
    @emersonaraujo406 4 роки тому

    Amazing community job. It is awesome how you teach and the degree of knowledge you certainly have. Thanks a lot!!!

  • @deckerdsgaming8751
    @deckerdsgaming8751 4 роки тому

    Thanks mate. you just saved my day. Perfect step by step explanation

  • @let_go429
    @let_go429 5 років тому

    new sub and bell button smasher here. Your videos are pure gold! Thank you, Mr. Halliday

    • @leighhalliday
      @leighhalliday  5 років тому +1

      Excellent! Thanks for watching let_go let's_code!

  • @dettieee
    @dettieee 4 роки тому

    Thankyou, this was great! short and straight to the point!

  • @mehulgawhale5255
    @mehulgawhale5255 3 роки тому

    Clean teaching skills and you bring rare contents👍✨

    • @leighhalliday
      @leighhalliday  3 роки тому +1

      Thank you Mehul, glad you enjoyed it!

  • @axhaferllari2882
    @axhaferllari2882 4 роки тому

    This library is great! Thank you for the walk through.

    • @leighhalliday
      @leighhalliday  4 роки тому

      Thank you A Xhaferllari! Glad you liked it!

  • @c4973
    @c4973 2 роки тому

    On the client side, the return ( ) outputs latitude and longitude. Can you please tell me how to update the latitude and longitude on the server and how to output the current latitude and longitude geodata to the console from the server? I need to use this data in my project.

  • @aanex2005
    @aanex2005 4 роки тому

    Very detailed and straightforward! Thanks!!!

  • @anuraghazra4772
    @anuraghazra4772 5 років тому +2

    Keep them coming.. I love your videos. 😊

  • @bayabeltes69
    @bayabeltes69 2 роки тому +1

    How can you load api key in next.js?

  • @shawyarshah231
    @shawyarshah231 3 роки тому

    hi, it's amazing video, but why I get "...has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header..." error, how can I fix it? please

  • @JannibalForKing
    @JannibalForKing 4 роки тому

    This is wonderful info!! Thanks Leigh it really helped me out

    • @leighhalliday
      @leighhalliday  4 роки тому

      Thanks Jan! Glad the video was able to help :)

  • @islamicinterestofficial
    @islamicinterestofficial 3 роки тому

    I followed exact same steps but it keeps "...loading". My API key is also correct. I am very worried. plz help me sir

  • @neurogenesiss
    @neurogenesiss 3 роки тому +1

    Man, you saved me!!

  • @mohamedkalid8713
    @mohamedkalid8713 2 роки тому

    thank you leigh halliday

  • @vinaykanth7453
    @vinaykanth7453 4 роки тому

    That's a great help. I was able to implement this feature in my project. Thank you.

    • @leighhalliday
      @leighhalliday  4 роки тому

      Awesome!! Check out this video if you'd like to see how to integrate it into a map: ua-cam.com/video/WZcxJGmLbSo/v-deo.html

  • @edwardandresmoronquintana4852
    @edwardandresmoronquintana4852 4 роки тому

    very very very nice bro, greetings from medellin, Colombia

    • @leighhalliday
      @leighhalliday  4 роки тому

      Mucho gusto, Edward! Tengo ganas de ir a Medellin... iba a ir este año pero no se pudo por lo de COVID. Ojala en 2021!

  • @snowhite414
    @snowhite414 2 роки тому

    Hello. How can I get the city from the results? Please and thank you!

  • @Hasan-Alsamman
    @Hasan-Alsamman 2 роки тому

    hello, i have a q, i want to display my points first when i search locations , how to add my location to suggestion?

  • @nikhilgupta2569
    @nikhilgupta2569 3 роки тому

    Thanks a lot for the video. Can I restrict suggestions from a specific country?

  • @ellisdee2013
    @ellisdee2013 4 роки тому

    Thank you for the video! It really helped me out. Liked and subscribed.

    • @leighhalliday
      @leighhalliday  4 роки тому

      You're welcome, Stephen! If you're interested, here's a video I made with google places and google maps together: ua-cam.com/video/WZcxJGmLbSo/v-deo.html

  • @Y_hass
    @Y_hass 3 роки тому

    Great work! saved me lots of time!

  • @denniskjin
    @denniskjin 2 роки тому

    Super helpful tutorial! If i had several different fields i.e Street Address, City, State etc how would I be able to parse the autocomplete result to fill those fields?

  • @karaokeyoga2868
    @karaokeyoga2868 3 роки тому

    Thanks! Any advice on how to use react-select instead of a generic input?

  • @snowhite414
    @snowhite414 2 роки тому

    Hi. Thank you for this video. Very clear and helpful. If you have time can you teach us how to add additional suggestions like the first one inside the suggestion is "use your current location" and follow the API suggestions? I don't know how and have no idea if its possible. Thanks

  • @hyetigran
    @hyetigran 4 роки тому

    Thank you for the video. Is it possible to get autocomplete search to show businesses? i.e. McDonald's, City Bank, etc? Or would you recommend using a different api for that

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Tigran! Yup, you can... look into the searchOptions prop: github.com/hibiken/react-places-autocomplete#searchoptions
      And then you can pass in the `types` option to bring back businesses: developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest.types

  • @percytataje8763
    @percytataje8763 4 роки тому

    Hello, i have a error in library , Cannot read property 'onBlur' of undefined when i write in input ?

  • @KingCommerce
    @KingCommerce 2 роки тому

    Awesome! Thanks Leigh :)

  • @hienlong9873
    @hienlong9873 3 роки тому

    Awesome tutorial!

  • @boskameel
    @boskameel 3 роки тому

    I’m building a road trip react webapp. Where you can manage different road trips. I can use this!

  • @janeiroplacido2817
    @janeiroplacido2817 3 роки тому +1

    i need enable billing but i have not card, what can i do?

    • @leighhalliday
      @leighhalliday  3 роки тому +1

      Honestly that's a problem! You might want to look for free alternatives... unfortunately google wants a Credit Card. Maybe look to get a Visa Debit card if it's available in your country.

    • @janeiroplacido2817
      @janeiroplacido2817 3 роки тому

      @@leighhalliday thanks! I used my card, google says they will not take my money until i accept they take it automatically , I hope 🤞 it 😅

  • @paolosmith7268
    @paolosmith7268 5 років тому

    Tank you very much. It's possible to use that together with 'react-google-maps'/api ? If it's possible, how can we put only one time the url for both ?

    • @leighhalliday
      @leighhalliday  5 років тому

      Hey Paolo! I'd probably stick to one or the other, rather than both.

    • @hendriagustino7845
      @hendriagustino7845 5 років тому

      Hy Paolo! I think from using this package which return us the object {lat: x, lng: y} , u can easily proceed to use this lat lng coordinates value to render the location/place to your react-google-maps.

    • @faiqueali
      @faiqueali 4 роки тому

      @@hendriagustino7845 I am updating coordinates to googlemap center property but its not getting update, I also tried useRef but no luck, could you help me how to update center and zoom using this tutorial code..?

  • @shubhamwaghamore2331
    @shubhamwaghamore2331 2 роки тому

    Hey Leigh I am facing issue while doing this that is REQUEST_DENIED while onchange of the field how do I resolve it I am trying to do in localhost for understanding purpose I created API keys for API geolocation, places, geocoding maps javascript API but still can't resolve it
    And do I need to enable billing for using localhost too? Please have look on this issue

    • @leighhalliday
      @leighhalliday  2 роки тому

      Have you enabled both geolocation and places apis?

  • @AnandSingh-jo6gf
    @AnandSingh-jo6gf 3 роки тому

    Can we fetch City, State and zip code from the address?

  • @JustinThegamerBR
    @JustinThegamerBR 3 роки тому

    me ajudou demais , te amo

  • @MultiShami007
    @MultiShami007 4 роки тому

    Great video!!! helped me a lot. Thumbs up!

  • @sautante
    @sautante 4 роки тому

    In order to use geocodeByAddress did you have to enable the Geocode API? The problem is that it's not free. Is there any other way to get the lat and lng of what's searched?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey sh2345, I think it's free as long as you don't cross a certain threshold, but you do have to put in your credit card details. I'm not sure... have you found another API that does something similar? Maybe this one? locationiq.com/ or this one? opencagedata.com/api

    • @sautante
      @sautante 4 роки тому

      @@leighhalliday Ah I see, I took a look at opencagedata and managed to get the lat and lng. Thanks!

  • @tntfit2614
    @tntfit2614 3 роки тому

    does this library work with react native as well??? seeing how there is no script tag in native?

  • @alizalakhani7300
    @alizalakhani7300 4 роки тому

    Thanks for the tutorial. Helped me with my work.

  • @minahilshafique7850
    @minahilshafique7850 3 роки тому

    my suggestions array is always empty... can someone guide?

  • @aminigbopaul4021
    @aminigbopaul4021 3 роки тому

    I get error
    even when i cloned the repo, it loads forever

  • @joshuad4548
    @joshuad4548 4 роки тому

    Is there a way to limit search to only citys and towns, no exact addresses?

    • @leighhalliday
      @leighhalliday  4 роки тому

      I believe so! Check out the google places options/documentation to see how you can limit search results.

    • @joshuad4548
      @joshuad4548 4 роки тому

      @@leighhalliday thank you. searchOptions

  • @sayansahoo4746
    @sayansahoo4746 4 роки тому

    Hi, I tried to load the API in index.html file within the script tag, provided my google maps javascript API key, and yet I get this ApiNotActivatedMapError error. If you could say why this is happening? My keys are enabled and authorized for this particular project.

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      Hey Sayan! Off the top of my head I don't know, but googling this StackOverflow comes up which talks about the exact error you seem to be running into: stackoverflow.com/questions/35700182/apinotactivatedmaperror-for-simple-html-page-using-google-places-api
      Make sure that "Google Maps JavaScript API" is enabled for your key.

    • @sayansahoo4746
      @sayansahoo4746 4 роки тому

      @@leighhalliday Thanks! I will check it out, even though I made it sure the api is enabled and activated.

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      There might be two APIs you have to enable when using places API... I forget :)

  • @chinwewatkins2808
    @chinwewatkins2808 3 роки тому

    you are a life saver!! thank you!! great tutorial!!

  • @leahjames2791
    @leahjames2791 4 роки тому

    Hi, really nice tutorial. I wanted to save the {coordinates.lat} and {coordinates.lng} in a const variable to be passed into a two dimensional array. But I dont now how to I cant seem to store it within the return itself. Any suugestion? thanks!

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      Hey Leah! I think you'd have to do something like this:
      const coordsPair = [coordinates.lat, coordinates.lng]

    • @leahjames2791
      @leahjames2791 4 роки тому

      @@leighhalliday Thanks a lot !

  • @edwardvakhovsky891
    @edwardvakhovsky891 3 роки тому

    Love it!

  • @denysbielkin4471
    @denysbielkin4471 3 роки тому

    Thank you for the video :)
    Can you tell, please - is there a posibility to recieve more than 5 results?

    • @leighhalliday
      @leighhalliday  3 роки тому

      Hey! Thank you! I am not sure actually! You'd have to check out the docs :D

  • @stephenhackett-delaney9401
    @stephenhackett-delaney9401 3 роки тому

    Amazing tutorial! Thank you very much

    • @leighhalliday
      @leighhalliday  3 роки тому

      Thanks Stephen! Glad you enjoyed it :)

  • @joshuad4548
    @joshuad4548 4 роки тому

    Have you used or suggest any libraries for reverse geocoding? client side

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      Hey No Kap... hmm, the truth is that I don't think a library can actually do it, you need some sort of API. Google has one you can use: developers.google.com/maps/documentation/javascript/examples/geocoding-reverse But you could also do a search and see if there are any others.

    • @joshuad4548
      @joshuad4548 4 роки тому

      @@leighhalliday you're right, just a simple request. thank dude. You really simplified the autocomplete functionality for us

  • @seymurmammadov3868
    @seymurmammadov3868 4 роки тому

    So the autocomplete function works on my reactjs app but when I select one it does not finish the input field text and throws me an error saying my API does not have access to this. I have geocode, places, maps all enabled. Someone can help me?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Seymur! Make sure that your API key is being added correctly (via environment variable) in the app. Maybe that is the issue?

  • @veaaltanuwijaya6193
    @veaaltanuwijaya6193 4 роки тому

    Sir Leigh how to use twice the app.js ? like i want to display 2 times ( i can input twice different address ) i try using div root twice but its seems doesn't work can u help me ?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Veaal! Instead of using app.js twice... maybe move the contents of to it's own component, and then include that twice within ... like this:
      function App() {
      return (


      );
      }

    • @veaaltanuwijaya6193
      @veaaltanuwijaya6193 4 роки тому

      @@leighhalliday thx a lott Sir! have a good day *p.s. : thanks for helping me even i ask a lot hehe

  • @אלאאיחיה
    @אלאאיחיה 3 роки тому

    should we pay for API key? because I'm getting an error that tells me to pay for one! I thought it's free :(

    • @leighhalliday
      @leighhalliday  3 роки тому

      You have to enter your credit card but you should be more than fine on the free tier.

    • @אלאאיחיה
      @אלאאיחיה 3 роки тому

      Thank you! I have a student account so it turns out to be free for students! That's awesome! thank you for the strait forward tutorial!

  • @grandmaitrediamantducongo8806
    @grandmaitrediamantducongo8806 4 роки тому

    hey thank you for the video , I did exactly everything as you explained in the video , but I can't get it to work. I'm having the OVER_QUERY _LIMIT issue with a new api key . do you have any insights ?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Turama! Are you using this just for local development or is it on a deployed website? You may need to enter in your credit card details if you're going over the limits.

    • @grandmaitrediamantducongo8806
      @grandmaitrediamantducongo8806 4 роки тому

      @@leighhalliday thank you for replying, billing information was set up already but error was till showing. how would you go about making this a component instead of using it directly like in your App class.?

  • @ericliu2325
    @ericliu2325 3 роки тому

    Does this work with addresses? Like typing 123 main street

  • @veaaltanuwijaya6193
    @veaaltanuwijaya6193 4 роки тому

    Hello Sir Leigh Halliday, thanks for the great video. I'm wondering on how to run the 'npm start' which is suggested, my API key already inputed but stuck on npm thing which still result blank page in index.

    • @veaaltanuwijaya6193
      @veaaltanuwijaya6193 4 роки тому

      nvm found it :D keep up the vids!

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      Nice! Glad you got it figured out Veaal!! :)

    • @veaaltanuwijaya6193
      @veaaltanuwijaya6193 4 роки тому

      Sir Leigh sorry for asking again!, how to combine the index.html custom with the npm ?

  • @muhdkbn6456
    @muhdkbn6456 4 роки тому

    Help me , how can i get API key for google places

    • @leighhalliday
      @leighhalliday  4 роки тому

      Start here: console.developers.google.com/

  • @craftmoon-vas
    @craftmoon-vas 4 роки тому

    Hey Leigh! Thx for the tutorial. One question. I'm using react-google-maps that you used in your other video, and in that WrappedMap component we put googleMapURL as a prop. In this one, it needs to be as a script. When I do both I get "You have included the Google Maps JavaScript API multiple times on this page". Is there a way to include this google maps url script just once while using both libs ?

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      Hey Vitor! That's a really good question. As far as I can tell, you can use react-google-maps with an HOC (high order component) called withGoogleMap that looks like it assumes you already have the google maps script installed on your site elsewhere. That might solve your problem! tomchentw.github.io/react-google-maps/#withgooglemap

    • @craftmoon-vas
      @craftmoon-vas 4 роки тому

      @@leighhalliday Dude, thanks a lot! I just tried it and it worked perfectly. Thanks! :)

  • @mohsinalisoomro6336
    @mohsinalisoomro6336 4 роки тому

    Thanks for the video it works fine when run locally but when deploy on the firebase it gives me the error of {cors} if you have a solution please reply me i will appreciate it

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      Hey Mohsin! Sorry, I don't have a solution off top of head.

  • @khoilam7569
    @khoilam7569 3 роки тому +1

    thanks sir

  • @ishaanpuri901
    @ishaanpuri901 3 роки тому

    Hey! Great stuff! If you dont mind replying, I keep getting the ...loading when I input something. Would you mind telling me whats wrong?

  • @martinmajorov5921
    @martinmajorov5921 4 роки тому

    Having an issue with this one. Cannot get the answer with suggestions from google maps. It doesn’t even show ...loading . API key is attached and it seems like an empty array is coming back to suggestions. Maybe you can help?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Martin! It's hard to help without being able to see the code you're working with. Happy to take a look if you'll share.

    • @martinmajorov9725
      @martinmajorov9725 4 роки тому

      @@leighhalliday github.com/guitdev86/good-morning/blob/master/app.js

    • @martinmajorov9725
      @martinmajorov9725 4 роки тому

      I was able to follow until this point. I actually tried initial code from www.npmjs.com/package/react-places-autocomplete and it works. So I don't really get it where is my bug...

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Martin! Unfortunately I don't think this is a public repo so I'm not able to check the code out.

    • @martinmajorov5921
      @martinmajorov5921 4 роки тому

      Leigh Halliday didn’t notice it was private. It’s open now.

  • @kalilmagal2733
    @kalilmagal2733 3 роки тому

    I tried it, but it says I must enable billing on the Google.

    • @leighhalliday
      @leighhalliday  3 роки тому +1

      Yup, unfortunately it’s true. You’ll be in the free tier most likely but you must have billing enabled.

  • @dimitarchukovski9263
    @dimitarchukovski9263 3 роки тому

    tip: For key error add -> key={suggestion.placeId}

  • @brosslightyear9417
    @brosslightyear9417 4 роки тому

    Google place api is need configure billing account?

    • @leighhalliday
      @leighhalliday  4 роки тому +1

      Unfortunately, yes... it shouldn't cost you anything though.

  • @preetimaurya8687
    @preetimaurya8687 3 роки тому

    Can you please..explain..How to add google review in react js

    • @leighhalliday
      @leighhalliday  3 роки тому

      Hey Preeti! I don't even know what Google Review is :D

  • @olhamazurenko4152
    @olhamazurenko4152 5 років тому

    Thank you very much for the video!

  • @TrungNguyen-bz7nh
    @TrungNguyen-bz7nh 4 роки тому

    Many thanks , bro .

  • @alextraill1957
    @alextraill1957 4 роки тому

    Any ideas how to sort just by airports?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Alex! You can limit which "types" the API returns... there is some documentation about that on this page: developers.google.com/places/web-service/autocomplete

  • @saurabrakshit405
    @saurabrakshit405 2 роки тому

    It is more easy to understand If you have showed how & from where you have got the script tag which you integrated in index.html & how you generated the map API .
    Now struggling in getting the script tag if you dont mind please share the above request .

  • @asekawarnakulasooriya7909
    @asekawarnakulasooriya7909 4 роки тому

    Can you please Intergrate the autocomplete in to a map as well

    • @leighhalliday
      @leighhalliday  4 роки тому

      Aseka, it's your lucky day! ua-cam.com/video/WZcxJGmLbSo/v-deo.html

  • @alan_1213
    @alan_1213 4 роки тому

    Hi. Is there any alternative to google places? It is not free and i already exceeded my quota

    • @leighhalliday
      @leighhalliday  4 роки тому

      I haven't used any... I know they exist though, I think you'll have to do some googling :D

    • @alan_1213
      @alan_1213 4 роки тому

      Leigh Halliday thanks Leigh. I did google and found couple. My project is non-profit so I can’t pay for any product. But the project will have users and I don’t want to hang people with unreliable service. How do you go about in this type of situations? Do you simply buy or make your own from scratch (autocomplete search in this case) ?

  • @AlainRivera-j3o
    @AlainRivera-j3o 3 роки тому

    Thanks, Your videos are amazing, I have implemented and everything is ok except when I click with the input empty because an error is triggered with legend ZERO_RESULTS or INVALID_REQUESTS and I can't catch that problem to avoid that app brearks even if I try with onError attribute, this last option is useful when there are no mathces but if I click enter with empty input the error breaks the app. I hope somebody can guide me with this problem. Thanks.

  • @letsplayirishkid
    @letsplayirishkid 5 років тому

    How do you add the PlacesAutoComplete to your project?

    • @leighhalliday
      @leighhalliday  5 років тому

      Check out the installation instructions here: github.com/hibiken/react-places-autocomplete/blob/master/README.md#installation

  • @marlonpaulodasilva
    @marlonpaulodasilva 5 років тому +1

    like from Brazil

  • @mariiatkachova570
    @mariiatkachova570 4 роки тому

    it looks like I have to Try Google Cloud Platform for free. If I do it, will it charge me anything?

    • @leighhalliday
      @leighhalliday  3 роки тому +1

      I think you're OK as long as you fall within the "free tier"... you'd have to look up exactly how much usage that allows you.

  • @Kenndy16
    @Kenndy16 4 роки тому

    Hi, is "Current Location" part of the selection of choice?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Unfortunately not, you'd have to add it yourself using the browser's built-in geolocation.

    • @Kenndy16
      @Kenndy16 4 роки тому

      @@leighhalliday Oh I see, I want to build something like the Yelp address search bar with "Current Location". I was having a hard time finding any tutorial or article related to that. I also google "browser build in geolocation" and see some articles and videos related to React Native, but not for web browsers. If you know any, feel free to refer to me.

    • @Kenndy16
      @Kenndy16 4 роки тому

      ​@@leighhalliday If you plan to create more tutorial videos that use Google API, can you also include the setup procedure with Google Cloud Platform? I tried to follow your video and had to watch a different tutorial video to do the setup procedure. I was able to get past 06:33 of this video, but then 12:36, I get an error "Geocoding Service: This API project is not authorized to use this API." I couldn't move forward because I don't know what part of the setup is incorrect at the moment. In general, thank you for the tutorial though.

  • @cutiefon16
    @cutiefon16 4 роки тому

    Hi! I have a quick question, What if I want to add the latitude and longitude in array everytime i select a place? Any help would be appreciated! Great tutorial btw! :)

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Alfon! Create some state called `places`, and when they select a place, push it onto the state. Thank you!!

    • @cutiefon16
      @cutiefon16 4 роки тому

      @@leighhalliday I did try. But everytime i push it into state it get null value always. :(

    • @cutiefon16
      @cutiefon16 4 роки тому

      haha never mind i figured it out.:) I have a question though, what if i have 2 autocomplete how can i edit them separately or change their value separately when selecting a place?

  • @novaleighbui3860
    @novaleighbui3860 4 роки тому

    Hi Leigh, I'm having some issues. I have the exact same code, however my app doesn't show any "suggestions". It only shows the inputs, lat, and long. Any ideas on what's wrong?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Novaleigh! Sorry... nothing pops to mind immediately... keep troubleshooting! Use some console.logs and see what data your app has!

    • @novaleighbui3860
      @novaleighbui3860 4 роки тому

      Thank you so much for replying! Turned out it was because VSC cannot process the link to Google API. I honestly don't even know why they have this bug, but I wasn't aware of that, so it took me like 3 hours to figure this out. Anyways, GREAT VIDEO! And, thanks again!

    • @deborah-weiss
      @deborah-weiss 3 роки тому

      @@novaleighbui3860 how did you solve it? I'm working on VSC too and same thing, can't see the suggestions at all...

    • @novaleighbui3860
      @novaleighbui3860 3 роки тому +1

      @@deborah-weiss For me, it was the link to Google API that caused the issue. Before my link was split into two lines like in the video. Then, I fixed the issue by making it all connected on one line.
      For example
      Before:
      Link to
      Google API
      I fixed it to:
      Link to Google API

    • @novaleighbui3860
      @novaleighbui3860 3 роки тому

      Hope that helps!

  • @happysloth91
    @happysloth91 5 років тому +1

    I kind of wanna subscribe again

  • @mihirbagchi4171
    @mihirbagchi4171 4 роки тому

    hey is this using Places API only ? because I am getting an error-- "This API project is not authorized to use this API."

    • @leighhalliday
      @leighhalliday  4 роки тому

      No sorry, it's also using Geolocation API

  • @Kenndy16
    @Kenndy16 4 роки тому

    When I push my codes to Github, am I supposed to remove the Google API key?

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Kenndy! Yup, definitely. Don't want to commit that bad boy. Ideally have it in an environment variable.

    • @bishnusukla3788
      @bishnusukla3788 Рік тому

      ​@@leighhalliday To add api key from env file we have to load the script dynamically instead of static right? Also how can we add session token to optimise the cost?

  • @saurabrakshit405
    @saurabrakshit405 2 роки тому

    Nice vdo !
    While converting this code into Stateful component getting the below error :-
    Error: TypeError: Cannot set properties of undefined (setting ‘prop’)
    I have converted your Stateless component into Stateful in below manner :-
    import React, { Component } from "react";
    import PlacesAutocomplete,{geocodeByAddress} from "react-places-autocomplete";
    export default class App extends Component() {
    // constructor(props) {
    // super(props);
    // this.
    // }
    state = {
    address: ""
    };
    handleChange = (value) => {
    this.setState({ address: value });
    };
    async handleSelect(e) {
    const result = await geocodeByAddress(e.target.value);
    console.log("Selected Address:- ", result[0].formatted_address);
    console.log("Address:- ", result[0]);
    }
    render() {
    return (


    {({
    getInputProps,
    suggestions,
    getSuggestionItemProps,
    loading
    }) => (

    Address


    {loading ? ...loading : null}
    {suggestions.map((suggestion) => {
    const style = suggestion.active
    ? { backgroundColor: "#42a5f5", cursor: "pointer" }
    : { backgroundColor: "#ffffff", cursor: "pointer" };
    return (

    {suggestion.description}

    );
    })}


    )}


    );
    }
    }
    ----------------------------------------------------------------------------------------------------------------------------------------------------------
    I have put the state object in the constructor but still got the error then I have took it out of the constructor.
    So I want to know where I'm going wrong please bother a little to reply me with your fruitful solution.

  • @axlerodriguez3268
    @axlerodriguez3268 3 роки тому

    thanks mate

    • @leighhalliday
      @leighhalliday  3 роки тому

      No prob! Glad you enjoyed it, Axle.

    • @axlerodriguez3268
      @axlerodriguez3268 3 роки тому

      @@leighhalliday yeah i am hehe, you got a new subscriber and thanks again

  • @perenciolo659
    @perenciolo659 5 років тому

    Great job thanks. :)

  • @gbengaakingbulere6727
    @gbengaakingbulere6727 4 роки тому

    nice one

  • @christopherb.223
    @christopherb.223 3 роки тому

    Does it work on next js?

  • @geraldoagohoue3132
    @geraldoagohoue3132 4 роки тому

    Thanks

  • @smoust912
    @smoust912 4 роки тому

    Thanks pretty

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hehe... and thanks to you for calling me pretty, Smoust.

  • @attamjotsingh4474
    @attamjotsingh4474 4 роки тому

    I have got these errors : You must enable Billing on the Google Cloud Project and error happened when fetching data from Google Maps API. Assist me on this.

    • @leighhalliday
      @leighhalliday  4 роки тому

      Hey Attamjot! You have to enable billing on your google account that you got the google maps api key from... even if you're in a free tier, you have to enter a credit card for it to work.

    • @attamjotsinghkhurana4473
      @attamjotsinghkhurana4473 4 роки тому

      @@leighhalliday thank you so much .
      How to find nearby cities / areas based on city selection of another dropdown ?

  • @olaoluwaanigboro-napoleon6484
    @olaoluwaanigboro-napoleon6484 9 місяців тому

    So no one is talking about how the api_key is exposed for the whole world to see or y'all are not working on live projects where things like api_key is supposed to be confidential?

    • @leighhalliday
      @leighhalliday  9 місяців тому

      Hey! I delete the API keys after posting the video. That said, to use google maps on your site, the key must be public, because you'll need to have it in the browser. They key is to restrict its use, tying it to your domain and which services you require.

    • @olaoluwaanigboro-napoleon6484
      @olaoluwaanigboro-napoleon6484 9 місяців тому

      @@leighhalliday oh really? I'm sorry if I sounded harsh. I was working on a live project so I thought it was safer to hide the apikey and so I searched but didn't see a solution so I got frustrated. But thanks for this information, you are the second person who has told me this and now I have confirmed that I can leave it like that in the index.html...thanks and great video btw!