what does "On Your Network" in React mean - reactjs

What does "On Your Network" mean when I run npm start in a React Project
see image
what does On Your Network: http://192.168.56.1:3000 mean

"On your network" in this context means from another computer that's connected to the same network (eg. the same Wifi network). You could browse your locally-hosted React app from your phone, for example. That IP address is your computer's local IP address (which is different from your public IP address).

"on your network" means that on your local network like your wifi you can access your web page in your local network (that can be your phone or any computer or internet enabled device on your wifi) with that ip address. just type http://192.168.56.1:3000 in your browser.

Related

Can't connect to my React app from my mobile device

I am having some issues connecting to my React app running on my PC from my mobile device. I remember being able to do it awhile back, but for some reason it's not working anymore.
Both devices are on the same WiFi network. I have mesh routers and I verified they are connected to the same one (not sure if that matters). I'm running Windows 11 and trying to connect from an Android device.
I'm getting a connection timeout when trying to connect to my app from my phone (ip address below is fake):
This site can't be reached
192.559.2.27 took too long to respond
Try:
Checking the connection
ERR_CONNECTION_TIMED_OUT
I verified that the ip address I'm trying to connect to is the correct one and I am attempting to connect to the right port. Any thoughts on what the issue might be or some settings I could check?
The answer here was to simply set my home WiFi network as a private network. Windows 11 sets the network type to "public" by default, which prevents it from being discovered by other devices on the network.
On Windows 11, go to Settings -> Network & Internet -> Wi-Fi -> properties
Change the Network profile type to private
Obviously, you'll only want to do this on a trusted network and not a public Wi-Fi or anything.

Why can't I see my react-app through local network?

I want to see my react app in my local network, but I can't. When I run npm start to start the local host and see my react app, it gives me two URLs. One for my current device and the other for the local network. When I open the local network URL on my phone, I just see that the page is loading. It doesn't give me any errors. I've ensured that my IP address is correct. Previously I was able to see the apps through local network, so not sure if I'm missing something trivial.
Follow these steps:
Setting -> Network & internet -> Wi-Fi -> xyz propeties (here xyz is connected wifi name) -> Network Profile Type -> check as private
Firewall & network protection (search it and open it) -> Private Network -> Microsoft Defender Firewall turn off
Hope it will work...
The best way to test your ReactJS app on your phone is to Follow the following steps
Run your using npm start
After Go to the CMD in your windows machine and type the command ipconfig then enter that IP address with:3000 port in your Smartphone browser
For Example, if your IP is 192.168.1.101:3000. the IP address should use a 3000 port
Note:- Make sure your PC and Smartphone are Connected on the same Wifi network

Running localhost react app on mobile phones

I need to connect my react app to my local network by typing in localhost on any device. Im not sure if this is possible. Right now I use my computers IP address and I type the address into my phone browser with port 300 and it works. The only thing is that I am using auth0 and I need a list of callback urls for it to work. Basically anything other than localhost in the url will be blocked. So i need to type in localhost:3000 on my phone and my react app needs to show up.
You can use a service like lvh.me that resolves back to the IP you provide as the subdomains. This will be fairly stable, but you will need to specify the domain to Auth0.
For example, if your IP address is 10.0.0.5 and your app is running on port 3000, from your local network you would visit http://10.0.0.5.lvh.me:3000/ from your phone. This request would resolve to 10.0.0.5:3000.
I am afraid it's not possible. The localhost refers to 127.0.0.1 IP in your computer which is like a globally followed convention for all the devices in the world.
Your router assigns an IP like 167.12.124.12 for each of the devices connected to it and if any other device is connected to the same router, they can communicate with each other by using the IP the router created for the devices.
The router assigned IP won't change unless your device goes offline for some reason. Try adding the IP as an allowed URL in the list of URLs in Auth0.
Make sure both your phone and computer are connected the same wifii. Then, try to figure out how to find your IPv4 Address. The screenshot below shows where to find it on mac, I guess you can find it by typing ipconfig on terminal, too. This IPv4 address is your localhost. I usually run my react app's on port 3000 so when you go to yourIPv4address:3000 on your mobile phone's browser you can see your react app on mobile. Hope it helps. Good luck.

Reactjs Script Server not available

"React-scripts", a series of scripts from create-react-app starter pack allows me to use "react-scripts-start" to initialize a server.
Everything works fine, the server turns on and I can access it on localhost:3000 or by using the IP:3000
The problem is when I use other devices from my house. I try to connect to the IP:3000 and it doesn't work. I'm getting "Server not found".
Is it a Windows access problem or am I supposed to set up the server?
I managed to solve my issue. For me, it was not in the firewall, not in the configuration files. Instead, it was the router.
Since I live in UK, I have Hub 3.0 from Virgin Media.
The solution is:
1) Navigate to Connected Devices and copy the IP address for your device. In my case it was xx.xx.0.16/24 so I copied "xx.xx.0.16"
2) Navigate to Advanced Settings > Security > Port Forwarding
3) Click on "Create new Rule". For Local IP will be your IP address, local start port & end port 3000; external start port & end port 3000; Protocol choose both; Enabled on
4) Apply changes
Now here is the trick. When I run the command
npm run start
I'm getting a message which says:
You ca now view your project in the browser:
Local: http://localhost:3000/
On Your Network: http://xx.xx.37.1:3000/
I can navigate to that IP address : 3000 on the hosting laptop however if I want to make other devices access it, I must use the IP address set up in the router which for me is xx.xx.0.16:3000

Mobile IP Addresses

I know that when you hit a page on a site your IP gets logged and the owner can view it.
I've seen it with computers.
There can't possibly be enough IPs to cover all computers and cellphones...
So, since mobiles access by 2G, 3G, 4G, what is the IP that gets registered? Is it like PC accessing?
Do they even generate an IP?
I guess that for Wi-Fi connection they do get an IP, so what about the other signals?
With a 3g service provider you are on their network, so the IP Address will go through a NAT firewall/router and the ip of your device will be their public address such as AT&T.
Much like your home router works. Any computer on your home network will share the IP address of the router.

Resources