Build a Weather App in React JS | React JS beginner Tutorial

Поделиться
HTML-код
  • Опубликовано: 10 янв 2020
  • Learn how to make a Weather app in React JS, we use the Open Weather Map API to make calls to a restful api to return the current weather data. This uses the Modern Javascript Fetch AP along with React hooks and conditonals.
    A React JS Project
    Day 11 #31Days31Videos
    Source Code: github.com/TylerPottsDev/weat...
    // JOIN THE DISCORD
    / discord
    // MY GEAR FOR CODING AND RUclips
    Blue Yeti Microphone: amzn.to/3jr3l7T
    Microphone Stand: amzn.to/35B9LMN
    Chair: amzn.to/3dWds3F
    Thunderbolt Dock: amzn.to/3osBF6u
    Monitor: amzn.to/37I8KoR
    All of these products I own and have tested!
    FOLLOW ME ON TWITTER!!!
    / tyler_potts_
    LIKE, SUBSCRIBE & SHARE
    Music
    DEAF KEV - Invincible (NCS Release)
    Neffex - Grateful (NCS Release)

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

  • @dremiq6670
    @dremiq6670 4 года назад +409

    let months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
    let days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];

    • @Thejusticier44
      @Thejusticier44 4 года назад +12

      True hero

    • @dremiq6670
      @dremiq6670 4 года назад +2

      @@Thejusticier44 Kappa

    • @tejasvigupta07
      @tejasvigupta07 4 года назад +4

      Initially I thought why this comment got so many likes but now that I am building my own App

    • @dremiq6670
      @dremiq6670 4 года назад

      @Joshua (Nakjun) Paik i got u my g

    • @bhagyashingale5663
      @bhagyashingale5663 4 года назад +13

      {new Date().toDateString()}

  • @crazycat2969
    @crazycat2969 4 года назад +87

    14:00 Guys u don't even need that long code to build date. You can just easily take the date object and convert it to string (date object return day, month year...)
    For example:
    let date = String(new window.Date())
    date = date.slice(3,15)
    In my case date returns: May 25 2020

    • @axeljacob4632
      @axeljacob4632 4 года назад +9

      ||
      let today = new Date().toLocaleDateString()
      ||
      let today = new Date().toDateString();

    • @gallant7661
      @gallant7661 4 года назад +3

      I have these issues. What did I do wrong?
      'api' is assigned a value but never used no-unused-vars
      'day' is assigned a value but never used no-unused-vars
      'date' is assigned a value but never used no-unused-vars
      'month' is assigned a value but never used no-unused-vars
      'year' is assigned a value but never used no-unused-vars
      Unexpected template string expression no-template-curly-in-string

    • @alexsmith-rs6zq
      @alexsmith-rs6zq 4 года назад +3

      You don’t have to but it allows you to format the date in the way you want it to display. It’s a stylistic choice not bad practice.

    • @PeachiiWubs
      @PeachiiWubs 3 года назад

      @@gallant7661 in vscode get the extension eslint. then hover over the code with "no-unused-vars" and hit quick fix then click the disable no-unused-vars for the whole file.

    • @NoobMaster-nr3jw
      @NoobMaster-nr3jw 3 года назад +2

      no way it Elon Musk!!!!!! 😱

  • @Haldinyar
    @Haldinyar 4 года назад +116

    I learned a lot about CSS in this React tutorial lol.

  • @deekshithanand3094
    @deekshithanand3094 3 года назад +2

    I had never done this much CSS in my previous tutorials! Thanks, buddy learnt a lot...

  • @antoine483
    @antoine483 3 года назад +1

    thanks for this awsome tutorial, that was clear, well explain, never too slow or too fast ! Great job !

  • @ELGANDUZ
    @ELGANDUZ 4 года назад +1

    Thank you for the video! You're great at explaining and straight to the point

  • @buncha1499
    @buncha1499 4 года назад +6

    Great tutorial, thank you bro! One tip that is a great new feature, you can use optional chaining to replace the ternary for truthy or falsy results...

  • @khuloodfahad7485
    @khuloodfahad7485 3 года назад +4

    Thank you so much for this tutorial, I loved it! and BTW you have a lovely personality which make this video more enjoyable.

  • @Lohitpant
    @Lohitpant 3 года назад +5

    Thanks for this tutorial bro. While going through the Weather API site, I noticed that it provides info in Hindi also which is my native language. I added lang parameter in my api query and changed the days and months name in Hindi. Voila! I have a weather app in Hindi now.
    let months=["जनवरी",'फरवरी', 'मार्च','अप्रैल','मई','जून','जुलाई','अगस्त','सितम्बर','अक्टूबर','नवम्बर','दिसम्बर'];
    let days=["रविवार",'सोमवार','मंगलवार','बुधवार','गुरुवार','शुक्रवार', "शनिवार"]

    • @snehaagarwal6451
      @snehaagarwal6451 2 года назад

      my code not working! please help! i am using npm. ..cant fetch Api

  • @jessicaterryberry
    @jessicaterryberry Год назад +1

    This was super helpful! I'm currently interviewing for a position that uses React, and I've never done much coding with it.

  • @arshanaatapattu
    @arshanaatapattu 2 года назад +2

    This is very begginer friendly, keep up the good work. Thanks a lot Tyler.

  • @wesamal-shaibani8157
    @wesamal-shaibani8157 3 года назад

    Thanks for the awesome tutorial. I just added a few lines to view different picutures depending on the weather

  • @MegaMagnax
    @MegaMagnax 3 года назад

    Learned a lot from this tutorial, helped me build mine !! New sub

  • @thatdudelos9074
    @thatdudelos9074 2 года назад +53

    Trust me I learned way more from you than you will from me. The reason the transition wasn't working in your CSS code was due to not adding the "s" per the documentation for the transition property. Rather than just having
    transition: 0.4 ease-out;
    it should actually be
    //added an "s"
    transition: 0.4s ease-out;
    This was an amazing walkthrough and lesson. Thank you!

  • @teacherissagadem2769
    @teacherissagadem2769 4 года назад

    you just import everythings you need in react, it's wonderful

  • @ZK27RS08
    @ZK27RS08 Год назад +1

    I am a beginner and I really loved this in my initial learning.

  • @PeachiiWubs
    @PeachiiWubs 3 года назад +2

    thank you this was DOPE! learned a lot on css and react.

  • @dimalavrenov3916
    @dimalavrenov3916 Год назад

    Thanks, man. It was a good night

  • @nicksmith9640
    @nicksmith9640 3 года назад +5

    Great tutorial. I like how there was no fluff in it.

  • @MohamadMohamad-pl4eb
    @MohamadMohamad-pl4eb 2 года назад +2

    you are the only youtuber that make real projects, keep it up.

  • @santiagotorres8680
    @santiagotorres8680 3 года назад +4

    Thanks for sharing us your knowledge! you are amazing... I've learned a lot thanks to you :)

  • @imagine9085
    @imagine9085 3 года назад +1

    I Love your channel! Thank you for all your tutorials

  • @khoilam7569
    @khoilam7569 2 года назад

    verry clean thanks alot sir

  • @ManishKumar-xt6kf
    @ManishKumar-xt6kf 2 года назад

    Thank you so much brother
    Thank you so much
    The code was clean and very easy to understand.
    Thank you again

  • @hayfachouchene1285
    @hayfachouchene1285 2 года назад

    amazing tutos ! amazing channel ! kepp going ♥

  • @mohanedesmail
    @mohanedesmail 4 года назад +108

    Transition Error you must type s after the number
    transition: .4s ease;

    • @TylerPotts
      @TylerPotts  4 года назад +16

      My bad... I was so tired when I recorded this... haha Thanks!

    • @vishaldaryanani7757
      @vishaldaryanani7757 4 года назад +3

      @@TylerPotts Hope you got some rest :D

    • @klarnorbert
      @klarnorbert 4 года назад

      @@TylerPotts About the audio: in your video editing software, delete the trash audio channel, then make the right mono channel as stereo.

    • @manmeetsinghchhabra3923
      @manmeetsinghchhabra3923 3 года назад +3

      it still not worked

    • @rafeeque3593
      @rafeeque3593 3 года назад

      thanks bro

  • @jeremyAr
    @jeremyAr 4 года назад +3

    This is very therapeutic

  • @nick598l4d
    @nick598l4d 2 года назад

    Great tutorial, I learned a lot.

  • @anthonygrear6226
    @anthonygrear6226 3 года назад +1

    Well done. I learned a lot.Thanks!

  • @iconicwebdesigners6764
    @iconicwebdesigners6764 2 года назад +1

    lovely tutorial .... straightforward to understand and easy to follow thank you... thumbs up from me

  • @mustknow58
    @mustknow58 3 года назад +4

    You are awesome dude 💓
    Love from India

  • @syednomanahmed3526
    @syednomanahmed3526 4 года назад +1

    Quick, to the point and EXCELLENT work man. I learned a lot from this video. God bless you. (y)

  • @cannacare4467
    @cannacare4467 3 года назад +9

    "And the arrow function which takes the D....heh...heh...heh" LOL Made my day.

  • @diegoalfredo2467
    @diegoalfredo2467 2 года назад

    thank you so much! greetings from Mexico

  • @michaelguzman2294
    @michaelguzman2294 4 года назад

    Amazing. Thanks!

  • @nargesnahri1651
    @nargesnahri1651 2 года назад

    Thank you so much ,it was useful for me

  • @JovanMatthewIvander
    @JovanMatthewIvander 3 года назад

    Really Nice content broo, it helps me alot :)

  • @ragulmurugesan7182
    @ragulmurugesan7182 3 года назад +1

    Great Video Man. Thanks!

  • @adithyaajay1097
    @adithyaajay1097 3 года назад

    Cool Video! Keep making

  • @aayushkumar2736
    @aayushkumar2736 4 года назад

    I declared the transition for app warm class and it worked

  • @ilkhomjonkhudoyberdiev5619
    @ilkhomjonkhudoyberdiev5619 4 года назад

    thanks for the awesome video , really like it

  • @MrRonzy123
    @MrRonzy123 4 года назад

    Thanks for the tutorial.

  • @tuanconandoyle9674
    @tuanconandoyle9674 4 года назад

    That is a amazing work, thank you!

  • @mrdjanz5177
    @mrdjanz5177 2 года назад +1

    for that transition i used
    -webkit-transition: all 0.2s ease-in;
    and it worked pefectly. tnx for tutorial its great

  • @aganithshanbhag2296
    @aganithshanbhag2296 3 года назад +1

    Great Tutorial

  • @osamayousuf6135
    @osamayousuf6135 2 года назад

    God Bless you i learned a lot from this video thanks mate

  • @mstfsgdc
    @mstfsgdc 3 года назад +1

    Awesome tutorial, thx

  • @TomWalshHud
    @TomWalshHud 4 года назад

    great video! thanks very much :)

  • @lucianomariano
    @lucianomariano 4 года назад

    I love It! Ty very much

  • @avinashmahanthi6688
    @avinashmahanthi6688 3 года назад +1

    Greate tutorial learned both react and CSS also

  • @CK-uv9zu
    @CK-uv9zu 8 месяцев назад

    great video

  • @The-Empowerment-Engine
    @The-Empowerment-Engine 2 года назад

    thank you for this

  • @metquadi
    @metquadi 2 года назад

    thank you man

  • @avinashmurmu9070
    @avinashmurmu9070 3 года назад +3

    i didn't know how to use free apis because everytime they had this api key stuff and i used to get stuck all the time. Also I learned how to query and onKeyPress handler thing and search only when the user hits enter🔥.... Thank you so much❤️

  • @stanis_ts
    @stanis_ts 2 года назад +1

    thanks! awesome!

  • @rushdude87
    @rushdude87 4 года назад +8

    Great video, very helpful!
    I find your syntax highlighting incredibly useful, mine is just orange white and blue. It makes it difficult for me to distinguish variables etc.
    Is that a VS Code extension or a theme of some sort?

  • @abanerjee3704
    @abanerjee3704 2 года назад

    "The arrow function takes the d" *laughs- that got me XD. Great content mate, keep it up🤘🤘.

  • @luisacavalcanti3665
    @luisacavalcanti3665 2 года назад +1

    Works perfectly!!! (: thanks a lot

  • @abubalo
    @abubalo 3 года назад +1

    Great project 👍from 🇳🇬

  • @dannyman2200
    @dannyman2200 3 года назад +1

    Nice video!

  • @ezeibarra3110
    @ezeibarra3110 2 года назад +4

    Hi! Great tutorial! You fotgot the “s” of seconds in the transitions atributte.
    Answer: transition: 4 east-out;
    Correct Answer: 4s east-out;

    • @TylerPotts
      @TylerPotts  2 года назад +1

      Thanks for that!

    • @justturner9702
      @justturner9702 2 года назад +1

      Thanks

    • @justturner9702
      @justturner9702 2 года назад

      Any idea how I’m going to save everything so i can open it after I’ve closed it?

  • @adityawanjale2000
    @adityawanjale2000 2 года назад +1

    Great video 🔥...
    The way to fix transition - add a unit ('s') after the transition value in index.css file...
    Like - transition : 0.4s ease-out;

  • @yossia4389
    @yossia4389 3 года назад +1

    You genius thanks alot !

  • @hoangcongson4146
    @hoangcongson4146 3 года назад

    Thank you so much

  • @vikramjeetsingh1766
    @vikramjeetsingh1766 3 года назад +1

    nice tutorial mate

  • @zyan5544
    @zyan5544 3 года назад +1

    thank you so much sir this amazing content

  • @NERO-ez1mn
    @NERO-ez1mn 3 года назад

    holy shit the IF ELSE statements are so advance for me haha and the TYPE OF should have a seaparate tutorials and FOR LOOPS please we need an in depth noob lesson here haha if it is ok for you please. the way you code is mindblowing in a good way. a brain workout haha

  • @chicagonorthside613
    @chicagonorthside613 3 года назад +1

    Thank you!

  • @nehemiahlimocheburet1411
    @nehemiahlimocheburet1411 4 года назад

    nice one here

  • @Hamza-so9wx
    @Hamza-so9wx 2 года назад +1

    wow thanks

  • @YakubXuyCode
    @YakubXuyCode 3 года назад

    Amazing

  • @fertuna5714
    @fertuna5714 2 года назад +1

    Thank you

  • @electrotsmishar
    @electrotsmishar 4 года назад

    thank you

  • @juliollina
    @juliollina Год назад

    muy buen video ...me funciono muy bien y aprendí mucho del tema que estoy estudiando💣💥💥💥💥💥💥

  • @WebDevSurvivalGuide
    @WebDevSurvivalGuide 4 года назад +10

    For anyone following along who cannot get the transitions to work, you need to make the ease out transition be 0.4s (s for seconds) instead of just 0.4.
    Nice tutorial!

    • @TylerPotts
      @TylerPotts  4 года назад +2

      Hahaha I was a little tired when I recorded this... my bad xD Thank you :D

    • @jayfiled
      @jayfiled 3 года назад

      Why isn't this comment at the top? Thank you :-)

  • @34rbie
    @34rbie 3 года назад

    wow , thanks!!

  • @yoga-world369
    @yoga-world369 4 года назад +1

    Very nice tutorial.
    btw, I have a question. how do you usually build/deploy react app to production with NO source map? The files are minimized when I use "react-scripts build" (created using create-react-app), but I get the complete source code and source map from Production deployed app. Appreciate your response on this.

  • @tasjehale
    @tasjehale 4 года назад +4

    I’m ready, will be here in 12 hours! :-)

    • @TylerPotts
      @TylerPotts  4 года назад

      Whoops, I'll have to head home and set it for 3 😁😂

    • @tasjehale
      @tasjehale 4 года назад +1

      Tyler Potts Hahaha did you mean to set it for 3PM?

    • @TylerPotts
      @TylerPotts  4 года назад +1

      @@tasjehale It was supposed to be 1PM UK time today... xD

  • @paulrodriguez3198
    @paulrodriguez3198 3 года назад

    For the person who saw React yesterday first time that took time to understand

  • @MD-dw5ee
    @MD-dw5ee 4 года назад

    i like your desktop background wallpaper could you plz tell me where did get it from or did you make it on your own, great tutorial btw

  • @codep2007
    @codep2007 3 года назад

    awesome video, thanks!

  • @AjayDavis1995
    @AjayDavis1995 3 года назад

    Yo thanks for the great tutorial bro. I just have a question. How can I change the background image based on the main property from the json file? Like, if I have an image for clouds and another for rain, how do I change that?

  • @CodingFire
    @CodingFire 3 года назад +2

    You went to mountain XD 🤣

  • @StreetCertifiedRecords
    @StreetCertifiedRecords 4 года назад +1

    Hey mate, really appreciate the content here! I am just starting out with React and I am wondering if you can recommend any must-have plugins for your IDE? I am running Sublime Text at the moment. Thanks heaps.

    • @lostnfound8014
      @lostnfound8014 4 года назад +1

      use visualstudio or webstorm (many plugins are available there one of the best is live loader which will load all the component you changed act as a watcher, then colored brackets to make your code readable etc.)

  • @MrBradubes
    @MrBradubes 4 года назад

    @Tyler Potts Thanks for the tut, just one thing though, the font is very tiny. It would be better if you bump it up a bit on your next vids.

  • @daitoakyoeiken7735
    @daitoakyoeiken7735 2 года назад +3

    The transition property should have a 's' appended to time as per documentation. However,I was using Firefox so I still didn't get the transitions. Then I viewed in Edge and it worked fine.

    • @TylerPotts
      @TylerPotts  2 года назад

      Yeah I was just being blind xD

  • @leomonz
    @leomonz 4 года назад +7

    got teh openweather api and key myself, but getting 401 unauthorized error...

  • @jonasc8569
    @jonasc8569 4 года назад

    Hi, thanks for your video. Is it possible to use 'backgroundImage' to change the background picture?

  • @kamalsharma2839
    @kamalsharma2839 2 года назад

    Which extensions are you using to automatically space (enter space on pressing enter and retain the space after saving) and auto renaming and auto closing tags??? I have Prettier and Auto Rename and Auto Close extensions, but they are not working as usual in React Projects like in HTML, CSS, and JS projects (Vanilla JS)

  • @Woolypopopeepee
    @Woolypopopeepee 4 года назад

    Subbed great tutorial

  • @jaihind28
    @jaihind28 4 года назад +9

    at 4:33 time in video
    FROM WHERE HAVE YOU TAKEN THE BASE !!!
    after the key input

  • @AMITYADAV-nw9mx
    @AMITYADAV-nw9mx 3 года назад +1

    Thanks for the video Tyler. Wanted to ask that, can we make the background change using just vanilla javascript(not using react)?

  • @calebcadainoo
    @calebcadainoo 4 года назад +18

    32:22
    in the index.css it should be
    transition: 0.4s ease;
    you left out the s or seconds for the timing

    • @tefomotaung
      @tefomotaung 3 года назад +1

      this worked for me. thanks!

  • @JKTCreation
    @JKTCreation 3 года назад

    Nice video. I got a question, can we turn this app (developed in reactjs) into android/ios app? or it needs to rewritten completely in react native? because one thing in react native, everything is compiled into the apk, so slight layout changes needs to be recompiled and deployed to app store. cmiiw

  • @ianjojo
    @ianjojo 4 года назад

    thanks for much for this. can you point me in the direction of refactoring so that i can have multiple background image classes, ie for snow, rain, sun, clouds etc? i have the idea just not the logic.

  • @mrohitsingh
    @mrohitsingh 4 года назад +4

    How to get api Base url?

  • @rafeeque3593
    @rafeeque3593 3 года назад +1

    thanks manh.

  • @melissaarias2444
    @melissaarias2444 4 года назад +2

    I missed it. Thanks to notifications am here. Dont delete the video pls

    • @TylerPotts
      @TylerPotts  4 года назад

      Hi, I won't delete it ever! 😁

  • @_Dhruv-nj8dk
    @_Dhruv-nj8dk 3 года назад

    What changes should i make if want forecast instead of weather?

  • @Jarajesh
    @Jarajesh 4 года назад +1

    I am excited looking you code

    • @TylerPotts
      @TylerPotts  4 года назад

      Happy my code excites you!!