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

2020-05-04T00:00:00.000Z

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 0.0.0.0

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:

xxx.xxx.x.xx:8000

Happy coding!