How to view your Gatsby site on your mobile device in localhost


I love building websites using React and Gatsby for clients. My testing environment usually consists of a computer screen where Visual Studio Code is installed, a tablet and a mobile device. But how can i view my localhost Gatsby site on the other devices?

It's extremely simple. Instead of running your development environment by typing gatsby develop into the terminal just type:

gatsby develop -H

There you go now you are able to connect to your localhost Gatsby site and view your changes in real-time on your tablet and mobile device. Just ensure all your devices are connected to the same Internet or WiFi connection.

The URL for your localhost should look something like this:

Happy coding!