# IPAddress from React book component only works w/ "on your network"

**URL:** <https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505>\
**Category:** web dev\
**Created:** [March 15, 2019, 2:31am UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505 "2019-03-15T02:31:58Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![bullsharktestosteron](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@bullsharktestosteron](https://forum.kirupa.com/u/bullsharktestosteron)\
**Post date:** [March 15, 2019, 2:31am UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/1 "2019-03-15T02:31:58Z")

</div>

so from the React book, the `<IPAddress />` and `<IPAddressContainer />` app only shows the IP address on the screen when I click where the mouse is in this pic:

 ![ipaddressReact](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/4/4b52c2d537c1f23c2e18b1c388cfb03e602a3785.jpeg)

yet the picture in the book has localhost:3000 in the address bar. Did I do something wrong, or did the author forget to say something about this? I used npm start to run the thing.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [March 15, 2019, 4:58am UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/2 "2019-03-15T04:58:43Z")

</div>

There may be nothing wrong, for the HTTP Server adjusts what port it works on depending on a variety of system parameters. When you do navigate to localhost, what do you see?

Cheers,  
Kirupa

---

<div class="post-metadata">

**Author:** ![bullsharktestosteron](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@bullsharktestosteron](https://forum.kirupa.com/u/bullsharktestosteron)\
**Post date:** [March 15, 2019, 3:43pm UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/3 "2019-03-15T15:43:21Z")

</div>

when I navigate to the local host, all I get are the elipses that were put in in the constructor instead of an IP address

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [March 15, 2019, 4:10pm UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/4 "2019-03-15T16:10:02Z")

</div>

Does your browser’s Developer Tools Console display any errors?

---

<div class="post-metadata">

**Author:** ![bullsharktestosteron](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@bullsharktestosteron](https://forum.kirupa.com/u/bullsharktestosteron)\
**Post date:** [March 15, 2019, 4:29pm UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/5 "2019-03-15T16:29:09Z")

</div>

yes, in Chrome, I get this:

 ![ipaddressReact](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/7/75bfa45f4ba3345dc18654e7cd93d201bd67dd92.jpeg)

---

<div class="post-metadata">

**Author:** ![hungdzai](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hungdzai/32/9556_2.png) [@hungdzai](https://forum.kirupa.com/u/hungdzai)\
**Post date:** [March 29, 2019, 1:33am UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/6 "2019-03-29T01:33:07Z")

</div>

I’m having the same issue too, 429 error means the server has reached its limit or something…

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [March 29, 2019, 2:46am UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/7 "2019-03-29T02:46:03Z")

</div>

That seems really odd. The request should only be made once every time you refresh the browser (or have the hot reload functionality reload for you). Does the error keep happening even if you try again after a few minutes?

---

<div class="post-metadata">

**Author:** ![hungdzai](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hungdzai/32/9556_2.png) [@hungdzai](https://forum.kirupa.com/u/hungdzai)\
**Post date:** [March 29, 2019, 3:45pm UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/8 "2019-03-29T15:45:13Z")

</div>

Still happens. Here is the detail of the error message.

 ![35%20AM](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/3/32bd5e7430b97accd89cab69a27c3f21932e5572.png)

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [March 29, 2019, 5:33pm UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/9 "2019-03-29T17:33:47Z")

</div>

Does the example at this location work? [https://www.kirupa.com/react/examples/ipaddress.htm](https://www.kirupa.com/react/examples/ipaddress.htm)

I’m trying to figure out what ipinfo is using to track the rate limit.

---

<div class="post-metadata">

**Author:** ![hungdzai](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/hungdzai/32/9556_2.png) [@hungdzai](https://forum.kirupa.com/u/hungdzai)\
**Post date:** [March 29, 2019, 5:47pm UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/10 "2019-03-29T17:47:59Z")

</div>

Yes, the example still works.

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [March 30, 2019, 3:50am UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/11 "2019-03-30T03:50:43Z")

</div>

I have no idea what is going on here! Does anybody else have any ideas? ☹

---

<div class="post-metadata">

**Author:** ![Jasonliao](https://avatars.discourse-cdn.com/v4/letter/j/848f3c/32.png) [@Jasonliao](https://forum.kirupa.com/u/Jasonliao)\
**Post date:** [March 30, 2019, 8:25am UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/12 "2019-03-30T08:25:32Z")

</div>

I have the same issue too. The website’s example works, but not my localhost.

 ![33](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/8/85e5e99a8a77cd698f7e0545ab90294be50ed5a8.png)

---

<div class="post-metadata">

**Author:** ![aislyn666](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/aislyn666/32/9620_2.png) [@aislyn666](https://forum.kirupa.com/u/aislyn666)\
**Post date:** [May 8, 2019, 2:36pm UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/13 "2019-05-08T14:36:36Z")

</div>

I am having the same problem, but just from localhost. I happen to have tried this in a virtual machine and checked from the host system as well using the IP my VM has in the shared network, and with that the code works. My guess is that somehow the sender of the request to [ipinfo.io](http://ipinfo.io) gets to be “localhost” if you use the app as probably most people do when just trying out, and “localhost” most probably has way more than 1000 requests/month to them (see [Flexible pricing for the most accurate IP data - IPinfo.io](https://ipinfo.io/pricing)) and therefor we get blocked.

 ![JS](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/2X/8/891b9baf072b250c01c259f313bdc3ab8b726aec.png)

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [May 9, 2019, 5:25am UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/14 "2019-05-09T05:25:30Z")

</div>

Yep! That’s pretty much the only explanation that makes sense 😛

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [June 26, 2019, 4:52pm UTC](https://forum.kirupa.com/t/ipaddress-from-react-book-component-only-works-w-on-your-network/639505/15 "2019-06-26T16:52:03Z")

</div>

Hi everyone - I just posted a workaround here: [Chapter 14 too many requests error](http://forum.kirupa.com/t/chapter-14-too-many-requests-error/639460/4)

In short, you can sign-up for a free account at [ipinfo.io](http://ipinfo.io) and use the token as part of making the request. The other option is to just use my free token instead: [https://ipinfo.io/json?token=2277ce4bac0347](https://ipinfo.io/json?token=2277ce4bac0347)

```
  componentDidMount() {
    xhr = new XMLHttpRequest();
    xhr.open("GET", "ipinfo.io/json?token=2277ce4bac0347", true);
    xhr.send();
 
    xhr.addEventListener("readystatechange", this.processRequest, false);
  }

```

The only risk with using my token is that there is a slight chance that many of you might be using it daily and that the request limit might get reached 🙂
