How to open a create-react-app from another computer connected to the same network?

前端 未结 10 574
旧时难觅i
旧时难觅i 2021-02-02 06:38

I am using create-react-app and hosting in its default port localhost:3000 and want to access this from another device on the same net

10条回答
  •  醉酒成梦
    2021-02-02 07:05

    if you have two machines (lets say pc1 and pc2) and both are connected over the same wifi connection, then:

    • bind your create-react-app development server to your Wireless LAN adapter wi-fi IPv4 address (on windows type the command ipconfig.exe and unix-like systems type ifconfig).. you will find the ip address under something:
    • Wireless LAN adapter Wi-Fi (on windows)
    • wlp5s0 inet Ip_Address
    • in your sheel where you develop react run HOST=your_IP npm run start

    now, your development machin will be the server that serves the ui over it's IP_Address

提交回复
热议问题