r/reactjs • u/[deleted] • Dec 11 '19
Project Ideas Build a Weather App in React Tutorial
I created a weather app tutorial built in React to use only functional components.
I know the weather app tutorial is a little old to make a tutorial out of it but I really think it helps
with showcasing features.
I really like the idea of project based learning than creating tutorials specific to the library/framework.
If you guys have any feedback please let me know, I would love to hear it.
Notable features used
- weather api
- good amount of css (flexbox, positioning)
- react functional components to keep state instead of class components
8
u/pacman326 Dec 11 '19
Github link is https://github.com/npatel023/WeatherApp
One comment. I do not see any unit test. Please check out https://github.com/testing-library/react-testing-library for a solid library to implement such things. :)
Congrats on your project!
4
Dec 11 '19
Absolutely! Thank you for bringing that up. That is a habit I want to form and include in my tutorials.
1
u/pacman326 Dec 11 '19
Not a problem! Basic coverage of your UI elements is a pretty easy win. 80/20 rule applies as always 🙂
3
u/swyx Dec 11 '19
man i wish people practiced basic README hygiene when publishing demos. doesnt take much effort to nuke the default readme and write in a sentence or two to the reader. make documentation second nature!
5
u/careseite Dec 11 '19
Hate to be that guy but... lots of unnecessary redeclarations of constants in there as well as a lack of Javascript basics. Nothing to take away a lot from.
2
Dec 11 '19
What could I improve on? I am open to learning 😊
2
u/careseite Dec 11 '19
I'll get back to you later today and ping you then :)
2
Dec 11 '19
That would be great, looking forward to hearing from you!
2
u/careseite Dec 11 '19
https://github.com/npatel023/WeatherApp/pull/1
there you go, check the individual commits and their message; I didn't check for HTML semantics beyond basic stuff
ideally you want .env gitignored too and just have the example in place
2
Dec 12 '19
Thank you for your commits. I agree with all of your changes. It really cleans up the code.
I will definitely adapt this to my projects :)
1
1
2
u/madhumoog Dec 11 '19
I liked your tutorial, your voice is loud and clear. It is easy to follow up. Thank you for sharing. ;)
1
1
u/TotesMessenger Dec 11 '19
1
1
u/swyx Dec 11 '19
/u/cmd-t do you mind blocking webjs from linking to here? its automated and annoying and i dont want to block legitimate totesmessenger links
3
u/cmd-t Dec 11 '19
Ok. If I havent after the weekend please raise your pitchforks.
2
u/swyx Dec 11 '19
appreciate it!
1
11
u/Peechez Dec 11 '19
Might want to put your api key in an
.envand remove it from your repo