<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Samuel Airehrour</title>
    <description>The latest articles on DEV Community by Samuel Airehrour (@sammieeblaq).</description>
    <link>https://dev.to/sammieeblaq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F311423%2Fad2d8465-b5ea-4217-bf87-378ce64bedbd.jpeg</url>
      <title>DEV Community: Samuel Airehrour</title>
      <link>https://dev.to/sammieeblaq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sammieeblaq"/>
    <language>en</language>
    <item>
      <title>Weather Application using React Hooks and open weather map API</title>
      <dc:creator>Samuel Airehrour</dc:creator>
      <pubDate>Mon, 20 Jan 2020 13:48:36 +0000</pubDate>
      <link>https://dev.to/sammieeblaq/weather-application-in-react-hooks-4j0h</link>
      <guid>https://dev.to/sammieeblaq/weather-application-in-react-hooks-4j0h</guid>
      <description>&lt;p&gt;In an attempt to understand how to use external API's as well as react hooks for state management, I built a simple weather application using react hooks and the open weather map API (&lt;a href="https://openweathermap.org/api"&gt;https://openweathermap.org/api&lt;/a&gt;), it was a really educative experience.&lt;br&gt;
Here's how i built the application:&lt;br&gt;
Due to the simplicity of the application we would not bother ourselves with the styling of the application only the functionality.&lt;br&gt;
First we declare the hooks we want to use for the state:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VXMZ-I3n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wgk5pg8lbgxwyki8gfyy.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VXMZ-I3n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wgk5pg8lbgxwyki8gfyy.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
After which we create a getWeather function which set's the state of the parameters I wanted to get from the API. Here's the code which is embedded in the App.js:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LpVLssDF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6072w4kfntggmkr2b0ra.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LpVLssDF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/6072w4kfntggmkr2b0ra.PNG" alt="Alt Text"&gt;&lt;/a&gt;.&lt;br&gt;
After setting the state we now attempt to pass them down as props to our Weather and Form component:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YLAczjFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zhlouz6i4lwfe3tgsbvu.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YLAczjFX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/zhlouz6i4lwfe3tgsbvu.PNG" alt="Alt Text"&gt;&lt;/a&gt;.&lt;br&gt;
Going inside the Weather component, we have our passed down props to the Weather Component which we use to dictate what/how the data would be displayed on the web page, this component looks like this:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WB7uq0gH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ycvoit62acn0rl5w1ic5.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WB7uq0gH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/ycvoit62acn0rl5w1ic5.PNG" alt="Alt Text"&gt;&lt;/a&gt;.&lt;br&gt;
With these we're almost done with our application, remaining our Form component and what it looks like on the web.&lt;br&gt;
The very simple Form component looks something of the nature:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--D-4cPAnA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qsifu2h8yx1izvpzqld8.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D-4cPAnA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qsifu2h8yx1izvpzqld8.PNG" alt="Alt Text"&gt;&lt;/a&gt;.&lt;br&gt;
And finally we get to see what our app looks like after we've completed the project.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fqyCz9lH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/i0qx0k8guzuig38j79kb.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fqyCz9lH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/i0qx0k8guzuig38j79kb.PNG" alt="Alt Text"&gt;&lt;/a&gt;.&lt;br&gt;
The styling of this project can be done in any form or style as the reader wishes. My CSS is not the best, so i just did a simple styling for the application.&lt;br&gt;
This is what the folder structure looks like for anyone interested.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pQ1dHlj4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gx1i6wt0rizbjvzehabx.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pQ1dHlj4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/gx1i6wt0rizbjvzehabx.PNG" alt="Alt Text"&gt;&lt;/a&gt;.&lt;br&gt;
Here's a link to the project on github: &lt;a href="https://github.com/sammieeblaq/weather-app"&gt;https://github.com/sammieeblaq/weather-app&lt;/a&gt;&lt;br&gt;
This is my first ever blog post, so please like and leave a comment for feedback. Thank you&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
