Why does react native uses your ipport but not localhost?

Why does react native uses your ip:port but not localhost?
1 Reply
WillsterJohnson
localhost loops back to your own computer. This means if your phone tries to access localhost:port, it's trying to connect to itself. For it to instead connect to the dev server hosted on your computer, it needs to connect to your computer via ip:port instead. The only thing localhost:port will do on your computer is let you view your page in a browser on that same computer, which isn't useful for testing mobile functionality. ip:port lets you do this as well as lets your phone (or any other device on the same WiFi network) connect. a bit more technical detail; localhost is just a convenience name for a special IP address, when you try to connect to localhost, you're actually connecting to 127.0.0.1. In fact, you can use any IPv4 address which matches 127.*.*.* and it will loop back.
Want results from more Discord servers?
Add your server