Let's assume that you want to access a website that you are developing on your macOS computer (localhost) via your iPhone (connected via hotspot).
Go to network settings in your computer to know the local IP:
If you are developing a React application (port 3000 by default), you can access it from your iPhone by typing the computer's local IP in the browser:
Hi, I'm Erik, an engineer from Barcelona. If you like the post or have any comments, say hi.