<?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: Moaml</title>
    <description>The latest articles on DEV Community by Moaml (@morh).</description>
    <link>https://dev.to/morh</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%2F473146%2F1c28ca78-ba66-476b-958f-4ceeb5248d76.png</url>
      <title>DEV Community: Moaml</title>
      <link>https://dev.to/morh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/morh"/>
    <language>en</language>
    <item>
      <title>How to get the [ IP, location ...etc ] of anyone visit your site in React/JavaScript</title>
      <dc:creator>Moaml</dc:creator>
      <pubDate>Wed, 21 Oct 2020 06:49:16 +0000</pubDate>
      <link>https://dev.to/morh/how-to-get-the-ip-location-etc-of-anyone-visit-your-site-in-react-javascript-5h1k</link>
      <guid>https://dev.to/morh/how-to-get-the-ip-location-etc-of-anyone-visit-your-site-in-react-javascript-5h1k</guid>
      <description>&lt;h3&gt;
  
  
  My First Simple article at DEV Community :)
&lt;/h3&gt;

&lt;p&gt;i wrote a simple [Covid-19 Tracker], when you open it will give you the information of your country accord to your location.&lt;/p&gt;

&lt;p&gt;You can check my so simple project [Covid-19 Tracker] &lt;br&gt;
Github: &lt;a href="https://github.com/moamlrh/covid-tracker/tree/master" rel="noopener noreferrer"&gt;https://github.com/moamlrh/covid-tracker/tree/master&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  * NOTE : this article for absolute beginner:)
&lt;/h4&gt;

&lt;p&gt;It's easy, i don't wanna waste your time.&lt;/p&gt;

&lt;h2&gt;
  
  
  First Of All :
&lt;/h2&gt;

&lt;p&gt;we'll create a file called App.js :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftl0b7ejj4y2cej3vuin4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ftl0b7ejj4y2cej3vuin4.png" alt="App.js"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Request and API
&lt;/h2&gt;

&lt;p&gt;Then make get request to &lt;a href="https://ip.nf/me.json" rel="noopener noreferrer"&gt;https://ip.nf/me.json&lt;/a&gt;&lt;br&gt;
we'll use fetch to make request but you can use whatever you want [try with Axios]&lt;/p&gt;

&lt;p&gt;The response will Looks like :&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjmjmbz0pa21zwak863vk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjmjmbz0pa21zwak863vk.png" alt="response"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your information =&amp;gt; IP, Country, Country Code, City,ASN etc...&lt;/p&gt;

&lt;h2&gt;
  
  
  Finally,
&lt;/h2&gt;

&lt;p&gt;we can use it with React Hooks [useState, useEffect]:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnbde27smrmhuakgt50ka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnbde27smrmhuakgt50ka.png" alt="code"&gt;&lt;/a&gt;   &lt;/p&gt;

&lt;h2&gt;
  
  
  The Final result :
&lt;/h2&gt;

&lt;p&gt;country name, code, city, latitude &amp;amp; longitude&lt;/p&gt;

&lt;h5&gt;
  
  
  * latitude &amp;amp; longitude you can use it in your project if you use map or do whatever you want
&lt;/h5&gt;

&lt;p&gt;I hope you benefit from this article, &lt;br&gt;
Thanks for spend some time to learn new simple things.&lt;/p&gt;

&lt;p&gt;" LEARN &amp;amp; NEVER STOP "&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
