Build A React JS Weather App - OpenWeatherMap API - Tutorial

Sdílet
Vložit
  • čas přidán 12. 09. 2024
  • Build a React JS weather app using the OpenWeatherMap API. We will be using axios to connect with our API. There are probably a million ways to build a weather app and this is on a more basic level, but a great way to learn a few core fundamentals in React. Let me know what you think in the comments below.
    ZeroTo Mastery:
    - Master React JS Course - bit.ly/Learn-R...
    - Complete Web Developer in 2023 - bit.ly/Complet...
    Learn to code here!
    bit.ly/Code-Ch...
    OpenWeatherMap API:
    openweathermap...
    Github Repo:
    github.com/fir...
    ☕ Buy me a Coffee ☕
    www.buymeacoff...
    Instagram 💪
    / fireclint
    🔥 My Coding Equipment 🔥
    Logitech MX Wireless Keyboard - amzn.to/3xKPFiN
    Logitech MX Master 2S Wireless Mouse - amzn.to/3O5WmRD
    SAMSUNG 49-Inch Gaming Monitor - amzn.to/3mvUy8M
    Shure MV7 USB Podcast Microphone - amzn.to/3O00nqG
    Mic Boom Arm - amzn.to/3NHn6YU
    Monitor Desk Light Bar - amzn.to/3xzKlyj

Komentáře • 249

  • @UnknownUnknown-mt1oi
    @UnknownUnknown-mt1oi Před rokem +11

    This is my first React project and you made it so simple, interesting and attractive.

  • @egebarsbozdeniz6257
    @egebarsbozdeniz6257 Před rokem +2

    I came here because I was struggling with the undefined reading of temp part. Great solution, very straightforward. Well done!

  • @doobinl8505
    @doobinl8505 Před 2 lety +14

    Thanks for such a great video, one of the few videos where I was able to follow along the whole way without much hassle and refactoring the tutorial in a modern way just so it works.

    • @codecommerce
      @codecommerce  Před 2 lety +3

      That’s awesome man thank you! Code does become rather dated pretty quickly!

  • @archanarai2423
    @archanarai2423 Před 7 měsíci +3

    Hey clint awesome work, followed along and completed it.
    Made some changes as onkeypress and event is deprecated , and played with css styling too.
    Had an idea about axios but didn't implement it, it was fun playing around with code.
    Thanks a lot:)

    • @jessiefianu6881
      @jessiefianu6881 Před 6 měsíci

      Hello there, please can you tell me how you went about the onKeyPress. It's deprecated in mine too so I'm stuck with the code. Secondly my background image only covers 3/4 of the browser, is there anyway I can fix this?
      Thank you very much and I am looking forward to hearing from you.

    • @archanarai2423
      @archanarai2423 Před 6 měsíci

      @@jessiefianu6881 hi, since onkeypress was deprecated I used onKeyDown and it worked fine for me. And for covering your whole background image maybe use object-fit property

  • @melssf7852
    @melssf7852 Před 2 lety +4

    this tutorial exceeded my expectations and made things so much easier for me thank you so much! :) i will be following and using your tutorials going forward!

  • @majebell
    @majebell Před 2 lety +1

    Great tutorial. I've just found your channel, and helped already me a lot! Subscribed! Hope you upload more tutorials/short projects like this!

  • @obinnailoanya8730
    @obinnailoanya8730 Před 2 lety +1

    I started Learning React Last month and it felt different from Vanilla Javascript but you made it simple, after seeing this video, i play around with Rapid API, i am forever subscribed to this channel and if you decide to leave youtube, i will follow you to anywhere so i can learn whatever you know, lol. YOU MAKE IT VERY VERY VERY VERY SIMPLE. Thank you so much Sir

    • @codecommerce
      @codecommerce  Před 2 lety

      Thank you so much man! React makes things so incredibly easy!

    • @nanatieku5805
      @nanatieku5805 Před rokem

      How's the journey being so far Obinna?
      I started learning React a few weeks now. It's going quite well so far

    • @obinnailoanya8730
      @obinnailoanya8730 Před rokem +1

      @@nanatieku5805 I’m a pro now, I use it as the front end to the full stack applications I build, I use typescript too

  • @simranbanwait
    @simranbanwait Před 2 lety

    sir you have no clue how much i struggled to find a way to run a function on a key press, , this video helped alot , thankyou so much

    • @codecommerce
      @codecommerce  Před 2 lety

      Thanks man- I know that’s frustrating! Haha

  • @carlosarmandolariosrojas7870

    its simple but very useful, thanks man!

  • @grzegorzmolin
    @grzegorzmolin Před 2 lety

    Yeaaayy! Such a joy making the first reactive api webpage!! 🥳 Thank you very much!

  • @Lamamaaaa
    @Lamamaaaa Před 15 dny

    Thankyou so much for this amazing tutorial

  • @vasiliskalfopoulos7848
    @vasiliskalfopoulos7848 Před rokem +1

    very good job
    you can also add .catch in search location ,
    in case someone type a location that not exist , like dradubau
    const searchLocation = (event) => {
    if (event.key === 'Enter') {
    axios.get(url).then((response) => {
    setData(response.data)
    }).catch((error) => {
    console.error('Error fetching weather data:', error);
    setLocation('');
    });

    }

    }

  • @ElegantCoder
    @ElegantCoder Před rokem +2

    Great video again just completed it here is the code snippet to check if no city is found
    axios.get(url).then((response) => {
    setData(response.data);
    }).catch((error) => {
    alert(error.response.data.message)
    })

  • @the-boss-98
    @the-boss-98 Před 10 měsíci +1

    I was actually building a similar app by myself and this error 28:07 had me stuck the whole day. Thankfully found this video.

  • @IamPetrus
    @IamPetrus Před 11 měsíci +2

    Thank you for this walkthrough.
    On 7:48, did you add an emmet extension? figuring out right now how to get that Emmet Abbreviation suggestion to keep saving time. Current emmet extensions I have do not throw me options like yours

    • @DeyDreamMusic
      @DeyDreamMusic Před 10 měsíci +1

      I'm wondering the same thing, way faster workflow

  • @pouyabh
    @pouyabh Před 2 lety +2

    i'm learning react and i have to say it was a great video for beginners thanks for sharing it

  • @usmansahi
    @usmansahi Před rokem

    thank you so much.this is really cool and easy to understand. wish you best of luck for more this type of quick learning videos

  • @tsekonya2141
    @tsekonya2141 Před 2 lety +2

    Have to say thanks for these videos, was struggling with react for so long but watching these vids has helped me so much. Great content.

  • @maazmuhammad1013
    @maazmuhammad1013 Před rokem +3

    Increase the font size of Vs code so its easier to follow along.
    Thank you.

  • @palomamorais2384
    @palomamorais2384 Před 2 lety

    perfeeect , i was struggling to implement open weather, but you made it so simple, thanks a lot!!!!!

    • @codecommerce
      @codecommerce  Před 2 lety

      Thank you Paloma!

    • @shanu3682
      @shanu3682 Před 2 lety

      Hey.. I completed react js some times ago and looking for some beginners project. Can u help me with that..

  • @chandrakethans5835
    @chandrakethans5835 Před rokem +1

    Built my first react application thank you so much :)

    • @codecommerce
      @codecommerce  Před rokem

      Awesome dude!

    • @varunupadhyay2488
      @varunupadhyay2488 Před rokem

      does this api still working? should i follow this video?

    • @chandrakethans5835
      @chandrakethans5835 Před rokem

      @@varunupadhyay2488 yeah the api working it’ll take sometime to become active after that it’ll work just fine

    • @dharapandya2045
      @dharapandya2045 Před 6 měsíci

      Is it still working or not? Pls reply ​@@varunupadhyay2488

  • @moradgrey1173
    @moradgrey1173 Před rokem +1

    a good extension of that would be changing the background depending on the weather condition

  • @anupprajapati6843
    @anupprajapati6843 Před 4 měsíci +3

    What if you entered the city that does not exists , you should add condition to display "City Not Found" for that matter. Otherwise its 10/10 app Great!!!

  • @sablecipher
    @sablecipher Před 3 měsíci +1

    Thanks so much! This was great. Quick question, when it comes to pushing to GitHub, how do we hide the API key?

  • @js_dev_uk
    @js_dev_uk Před rokem

    Mate, this was brilliant. Thanks for the tutorial.

  • @dannykennah2007
    @dannykennah2007 Před rokem +3

    what happens if the user enters something that isn't a city? its not really finished.

  • @Charbasaur
    @Charbasaur Před 2 lety

    Great tutorial, I learned a lot. I subscribed and I'm excited for more. Thanks! :)

  • @ganeshsaladi5932
    @ganeshsaladi5932 Před rokem

    This is just brilliant , perfect tutorial exist , i made my first project for resume hurray

  • @julianmartinez3154
    @julianmartinez3154 Před 2 lety

    Appreciate the video. Has made so many things very clear for me. Well done sir, looking forward to future videos.

  • @thewpwing
    @thewpwing Před 2 lety

    Hi thanks for such a tutorial. First time using axios and find it very easy. Hope you will show such a small but important tutorial.

  • @ParthPrabhune-v2w
    @ParthPrabhune-v2w Před rokem

    Thank you so much man!!!!! It was really helpful

  • @coolguyike
    @coolguyike Před 2 lety

    im just learning react but i enjoy your teaching style, thanks brother!

  • @AparnaDhara-zs2kl
    @AparnaDhara-zs2kl Před 7 měsíci

    Really educational for beginners!!

  • @ramirorenteria7333
    @ramirorenteria7333 Před rokem

    Thank you for the tutorial! Really learned a lot!

  • @knightridergaming1106

    A new subscriber from Pakistan , Thanks really simple and straight forward 🥰

  • @Atesz0509
    @Atesz0509 Před 2 lety

    Really great and simple guide,subscribed!

  • @JehadiHellTransportAgency

    man i create apps fine but learning CSS with you really helped me a lot thanks from INDIA brother loved this project a lot

  • @vinaygoswami5374
    @vinaygoswami5374 Před 2 lety

    This is one of the best tutorial for using basic API

  • @andrei-petrulazar5564
    @andrei-petrulazar5564 Před 2 lety

    Great content! I learned many useful things. thanks a lot !!

  • @engbesher7479
    @engbesher7479 Před 2 lety

    keep it up best tutorial ever it works with me thanksssssssss

  • @hcw1566
    @hcw1566 Před rokem +1

    This tutorial really helps me to practice React with API~
    At the end of the course, I found that while refreshing the website , the unit of temperature would still exist .I’d say that because it was written in ".top" not in ".bottom" . Was it right?
    Then i am trying to change the backgroung URl via using Pexel API . Hope it works.~~~

    • @codecommerce
      @codecommerce  Před rokem

      How are you making the API call?

    • @hcw1566
      @hcw1566 Před rokem

      ​@@codecommerce Pexel API can be used by searching pictures whatever keywords you want , with the location in weather website , it can search the weather and the pic at the same time ,and if i can't seacrh the city that i would use the default pic to display . But i did come up with a problem that i still can't figure it out , screen would flickered with the default pic while refreshing or searching new location . Sorry about that my English isn't really good.

  • @lucaspereira5388
    @lucaspereira5388 Před rokem +1

    hello men great video but the current API don't have the location parameter, only the latitude, and longitude

  • @joaquin_carp
    @joaquin_carp Před 2 lety

    thanks for your video, i really help me! greetings from Argentina.

  • @romanlupan7576
    @romanlupan7576 Před 2 lety

    Great tutorial and also a good explanation of each step

  • @viniciusm.m.7822
    @viniciusm.m.7822 Před 2 lety

    Thanks, dude! Keep it up!

  • @sheikhrasel854
    @sheikhrasel854 Před rokem +1

    Amazing ❤

  • @duytien69
    @duytien69 Před 2 lety

    Thanks for such a great video! i love this

  • @nikebelias7527
    @nikebelias7527 Před 2 lety

    Use an extension to right import react from 'react'';....
    This extension named: ES7+ React/Redux/React-Native snippets
    Then right rafce in each react functional component, for class based component rcc

  • @malinosterberg9877
    @malinosterberg9877 Před 2 lety

    Thanks for a great tutorial!

  • @Hoesayyyyyyy
    @Hoesayyyyyyy Před 2 lety

    Hell yeah man thanks explained everything perfectly i am going to try making a train schedule app now

    • @codecommerce
      @codecommerce  Před 2 lety +1

      Glad I could help - that sounds like an awesome project dude!

    • @Hoesayyyyyyy
      @Hoesayyyyyyy Před 2 lety

      @@codecommerce thank you my brother you helped me out a lot

  • @kingsleyezikeoha5023
    @kingsleyezikeoha5023 Před 2 lety

    an amazing video , thanks for this ,will be locked into your channel

    • @anask550
      @anask550 Před 2 lety

      can you please help me at 11:11 , the star wont work, what else can i use instead of it?

    • @codecommerce
      @codecommerce  Před 2 lety

      Thank you!

  • @tarekmustafa2525
    @tarekmustafa2525 Před rokem

    Great tutorial, thank you.

  • @Andyruuuu
    @Andyruuuu Před 2 lety

    Fantastic, thank you!

  • @abhay_Awasthicarguy7777

    I make this after seeing your video by myself.

  • @kevinm5898
    @kevinm5898 Před 2 lety

    Love the tutorial! First city entered is my city! Haha

  • @RohanSharma-dr1vy
    @RohanSharma-dr1vy Před 3 měsíci

    thanks for the video

  • @okage_
    @okage_ Před rokem +1

    hi, i made a seperate component for the search and for the actual information, how would i get the weather info from the search component to the information component so it can be displayed?

  • @mohamedboukhanouf
    @mohamedboukhanouf Před 2 lety

    thank you so much for this video it was amazing project

  • @JuNe-rm6pk
    @JuNe-rm6pk Před 2 lety

    Very good tutorial! Really helpfull! 👍 Maybe can we wish for a tutorial about a travel map app. something like that? That would be great. Thank you! 🙏

    • @codecommerce
      @codecommerce  Před 2 lety

      Great suggestion! That would really be cool - add in google map API!

  • @juancamilomarin7985
    @juancamilomarin7985 Před 2 lety

    Soy de colombia muchas gracias por tus videos por tu enseñanza mil gracias

  • @tiagocosta2689
    @tiagocosta2689 Před rokem

    Great video!

  • @jinda002
    @jinda002 Před rokem +1

    Im not sure what im doing wrong but the ${location} in the URL string doesnt update from the input.. my axios is getting error

  • @GoodGuyHeffy
    @GoodGuyHeffy Před 11 měsíci +1

    at 26:46 I keep just getting axios 404 errors. On the open weather site I had to scroll way down to find the API call example in this video. Says its no longer being supported, and the newer version uses Latitude and Longitude. Anyone know how to fix? API stuff is where im the weakest rn and I have a React interview in 2 days :/

  • @bhargav8263
    @bhargav8263 Před rokem

    great tutorial, thank you

    • @varunupadhyay2488
      @varunupadhyay2488 Před rokem

      does this api still working? should i follow this video?

    • @bhargav8263
      @bhargav8263 Před rokem

      @@varunupadhyay2488 yes working,api works after half an hour

  • @toyosisalami6453
    @toyosisalami6453 Před 2 lety

    Thank you so much for this tutorial! It was really fun and I learned a lot, including a previously unknown (to me) JavaScript method: toFixed()

  • @ayxan3950
    @ayxan3950 Před 2 lety

    Thank you This video is helpful

  • @damienchung1409
    @damienchung1409 Před rokem +2

    How can I deploy this project for showcase?

    • @codecommerce
      @codecommerce  Před rokem +1

      Heroku or GitHub pages are both free & easy! I have a video on both - super easy! 🙌

  • @corbinsbeats2540
    @corbinsbeats2540 Před měsícem

    Yeah but when you type in a wrong cuty it passes an eeror 404 in the console exposing your api key. How to fix???

  • @emiliafuks2594
    @emiliafuks2594 Před 2 lety +2

    Hi, thanks for this. Really helpful. I'm just wondering why you're keeping your API Key just hanging there out in the open? Any reason for that?

    • @codecommerce
      @codecommerce  Před 2 lety +1

      Hi Emilia! No- I should’ve put it in a .env file 🤫😏 hehe

    • @chucknorris7995
      @chucknorris7995 Před rokem

      @@codecommerce Do you have a video on .env files? I've been meaning to figure how to use them.
      Also, the feature: get current weather data by city has been depracated. Is still works tho. I been trying to get the coordinates from their geolocation api and then pipe that in to another api call.Kinda struggling with it. lol
      Thanks for the awesome content!

  • @adtddeathcore
    @adtddeathcore Před 2 lety

    esta tan bien explicado que aun sin dominar el ingles se entiende perfecto, excelente tutorial

  • @nedagholami374
    @nedagholami374 Před 2 lety

    Excellent🤩

  • @Abduraxmonm416
    @Abduraxmonm416 Před 5 měsíci

    good job my frends bravo

  • @ДенисКочев-э2ь

    Which VS code theme do you use? It seems like Dracula, but not exactly. Thanks for vid

  • @hawks2271
    @hawks2271 Před rokem +1

    Good job👏🇧🇷

  • @lucasamaral5429
    @lucasamaral5429 Před rokem

    Great video

  • @orielamar1620
    @orielamar1620 Před 2 lety

    I didnt understand what you did with the json file of the API result on 6:42. can i get an explaination of what was that and how to do it ? please :)

  • @javohirshirinboyev3533

    Thank you 👍👍

  • @michaellevi6743
    @michaellevi6743 Před 2 lety

    Awesome work Clint. Is there a way to have it automatically display from your browsers location vs. searching for a location. I haven't watched your whole video yet so not sure if you covered it or not

    • @codecommerce
      @codecommerce  Před 2 lety

      Thank you sir! I didn’t even think about that, but I’m sure you can!

  • @lewisnt_
    @lewisnt_ Před 2 lety

    good work bro keep it up

  • @jiyoungkim9258
    @jiyoungkim9258 Před 2 lety

    So nice 👏

  • @florencioaverroes7104

    I made a project like yours, following all those steps and I've finishided it. But, my extension "Live Server" isn't working all at. I've tried every option to have my project displaying on my browser and I couldn't. The things I've tried:
    - host IP;
    - choosing another browser;
    - windows's default browser;
    - linking CSS to ReactJS;
    - opening the project with the directory of origin;
    - naming the folders correctly.
    Do you have another option to suggest me?
    --
    If you can help me out, I will be pleased. I need your help 😢😢😢
    Anyways, buddy, nice tutorial and great job! Congrats!

  • @harshanabatagalla
    @harshanabatagalla Před rokem

    Thanks !

  • @xnetch2024
    @xnetch2024 Před rokem

    20.01 for stating state main part

  • @vevagaanandanpillai
    @vevagaanandanpillai Před 3 měsíci

    I was scratching my head because of the back ticks in the "url" variable. 😂

  • @phild5339
    @phild5339 Před rokem

    how could you alter this project so that you have a "gallery" of the different weather data for differnet locations?

  • @kevinleon4621
    @kevinleon4621 Před 8 měsíci +1

    Thanks papi

  • @longsteinpufferbatch4949

    Why is my onkeypress slashed out? Any help will be appreciated

    • @archanarai2423
      @archanarai2423 Před 7 měsíci

      It's deprecated now since it won't work in all browser, instead onKeyDown is used

  • @aymenbachiri-yh2hd
    @aymenbachiri-yh2hd Před 9 měsíci

    thank you

  • @isurudeshan420
    @isurudeshan420 Před 10 měsíci

    thanks

  • @rohithuneeks7184
    @rohithuneeks7184 Před rokem

    Should this project contains 2 microservices communicating each other ?

  • @miguelcosta4450
    @miguelcosta4450 Před 8 měsíci +1

    what you do to not exceed the request limit

  • @fatmamostafaa8118
    @fatmamostafaa8118 Před 2 lety +1

    I have a proplem everything is going well except when i take the weather.json data inside the file are not shown can you help me please

  • @nehat786
    @nehat786 Před 2 lety

    Great content it would be great if we see some easy more stuff with some bootstrap or material css

    • @codecommerce
      @codecommerce  Před 2 lety

      I should familiarize myself a little better with CSS libraries. I'm not a huge fan of bootstrap however I think material and tailwind is a little more appealing!

  • @aurrelko
    @aurrelko Před 2 lety

    Thanks for tutorial buddy, just wanted to say that your warning it was in line 43 need to be ( !==).

  • @beeekle
    @beeekle Před 2 lety +1

    @20:54 when I input the ${location} it throws the warning "Unexpected template string expression. eslint(no-template-curly-in-string)" and when i test it in the dev tools it gives a 404 error

    • @codecommerce
      @codecommerce  Před 2 lety

      does it reference the line of code?

    • @vladislavmitkov1580
      @vladislavmitkov1580 Před 2 lety

      I have the same problem, and can't find a solution.

    • @biratdatta
      @biratdatta Před 2 lety

      I am having the similar issue with 404 not found . I guess it is not unable to fetch data from the API and also the onkeypress={SeachLocation} doesn't work for me

    • @camo4970
      @camo4970 Před 2 lety

      make sure you put this line of code in between backticks ` ` and no quotation marks ' ' . this as a template literal otherwise it wont work

    • @wh0knowsprez
      @wh0knowsprez Před rokem

      @@codecommerce I have the same problem, It does not distinguish the ${location} between the api link (it counts it as one whole link). Any tips to resolve this?

  • @vitslama
    @vitslama Před rokem

    Mby use bootstrap next time it would save a lot of time with the styling

  • @nyashamusanhu541
    @nyashamusanhu541 Před 2 lety +1

    What if I want to print those responses to any specified file format like csv?

    • @codecommerce
      @codecommerce  Před 2 lety +1

      Hi Nyasha, I would have to look that up. I am not sure off the top of my head.

  • @anask550
    @anask550 Před 2 lety

    what can i use instead of the star at 11:11 ?

  • @stanleylafond4650
    @stanleylafond4650 Před 2 lety

    Thanks for the tutorial. One suggestion: It would be helpful when you are setting up files to explain what you are doing rather than saying "let's do that there", 7:36

    • @codecommerce
      @codecommerce  Před 2 lety

      Thanks Stanley - I'll try and be more specific

  • @camo4970
    @camo4970 Před rokem

    on minute 20:20 , why did you initialize the first state with {} as an object and the second one with "" as a string?
    how do i know when to use those?

    • @archanarai2423
      @archanarai2423 Před 7 měsíci

      I think it's because the data is gonna refer to whole json data object where as location is used only to store city name so it's initialized as empty string