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


#1

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:

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.


#2

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


#3

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


#4

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


#5

yes, in Chrome, I get this:


#6

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


#7

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?


#8

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


#9

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

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


#10

Yes, the example still works.


#11

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


#12

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


#13

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 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 https://ipinfo.io/pricing) and therefor we get blocked.
JS


#14

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