<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Leo Brown</title>
    <description>The latest articles on DEV Community by Leo Brown (@leobrown).</description>
    <link>https://dev.to/leobrown</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4100697%2Fe7c9f4fa-d597-4688-9177-2705cd70ff72.png</url>
      <title>DEV Community: Leo Brown</title>
      <link>https://dev.to/leobrown</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/leobrown"/>
    <language>en</language>
    <item>
      <title>How I test my React app on real devices without deploying it</title>
      <dc:creator>Leo Brown</dc:creator>
      <pubDate>Sat, 29 Aug 2026 20:37:23 +0000</pubDate>
      <link>https://dev.to/leobrown/how-i-test-my-react-app-on-real-devices-without-deploying-it-1ko</link>
      <guid>https://dev.to/leobrown/how-i-test-my-react-app-on-real-devices-without-deploying-it-1ko</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffjpoqy4xff8hhcf7wcqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffjpoqy4xff8hhcf7wcqz.png" alt=" " width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  How I test my React app on real devices without deploying it
&lt;/h1&gt;

&lt;p&gt;I recently needed to test a React app outside my own computer. Opening another browser tab wasn't enough. I wanted to use the app on my phone, try it on another device, and sometimes share the current build without deploying it first.&lt;/p&gt;

&lt;p&gt;The app was running locally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depending on the project, that usually gives me an address like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But &lt;code&gt;localhost&lt;/code&gt; only exists on my machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I tried
&lt;/h2&gt;

&lt;p&gt;There are several ways to expose a local development server to the internet. I tried a few tunneling services and approaches, and they worked, but I wanted something simpler for this workflow.&lt;/p&gt;

&lt;p&gt;My requirements were straightforward:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  one command to start a tunnel;&lt;/li&gt;
&lt;li&gt;  HTTPS without configuring certificates;&lt;/li&gt;
&lt;li&gt;  no deployment;&lt;/li&gt;
&lt;li&gt;  a URL I could open from my phone;&lt;/li&gt;
&lt;li&gt;  something convenient for React and Vite development;&lt;/li&gt;
&lt;li&gt;  preferably a hostname I could keep instead of receiving a new URL every time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I ended up using &lt;a href="https://portpreview.com/" rel="noopener noreferrer"&gt;PortPreview&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting a tunnel
&lt;/h2&gt;

&lt;p&gt;There isn't much to configure. With the React development server already running, I can expose its port from the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx portpreview 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My local address:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http://localhost:3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;is then available through a public HTTPS URL. I can open that URL on my phone and test the app there without making a temporary deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I use it for React development
&lt;/h2&gt;

&lt;p&gt;Chrome DevTools responsive mode is useful, but it doesn't cover everything. Some things need a real device:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  touch interactions;&lt;/li&gt;
&lt;li&gt;  mobile Safari and Chrome behavior;&lt;/li&gt;
&lt;li&gt;  viewport quirks;&lt;/li&gt;
&lt;li&gt;  authentication redirects;&lt;/li&gt;
&lt;li&gt;  camera or browser APIs;&lt;/li&gt;
&lt;li&gt;  network behavior;&lt;/li&gt;
&lt;li&gt;  links opened from messaging apps;&lt;/li&gt;
&lt;li&gt;  sharing a work-in-progress build with someone else.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of pushing a branch and waiting for a preview deployment, I leave the React dev server running and expose it directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Edit React code
      ↓
Local dev server
      ↓
PortPreview tunnel
      ↓
Real phone / remote browser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Changes from the local server appear through the tunnel immediately, so the workflow still feels like local development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I kept using it
&lt;/h2&gt;

&lt;p&gt;PortPreview lets me reserve one domain for free. That matters more than I expected because temporary URLs get annoying once you use tunnels regularly.&lt;/p&gt;

&lt;p&gt;A tunnel URL may be configured in several places:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  OAuth callbacks;&lt;/li&gt;
&lt;li&gt;  webhook endpoints;&lt;/li&gt;
&lt;li&gt;  API dashboards;&lt;/li&gt;
&lt;li&gt;  test integrations;&lt;/li&gt;
&lt;li&gt;  mobile devices;&lt;/li&gt;
&lt;li&gt;  bookmarks;&lt;/li&gt;
&lt;li&gt;  configuration files.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With a reserved hostname, I don't have to update those places whenever I restart my development environment. The free plan lets me reserve one domain permanently, which covers many personal development and testing projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  It isn't limited to React
&lt;/h2&gt;

&lt;p&gt;I started using PortPreview for a React app, but it works with anything listening on a local port, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  React / Vite&lt;/li&gt;
&lt;li&gt;  Next.js&lt;/li&gt;
&lt;li&gt;  Vue&lt;/li&gt;
&lt;li&gt;  Angular&lt;/li&gt;
&lt;li&gt;  Node.js&lt;/li&gt;
&lt;li&gt;  Express&lt;/li&gt;
&lt;li&gt;  NestJS&lt;/li&gt;
&lt;li&gt;  local APIs&lt;/li&gt;
&lt;li&gt;  webhook handlers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For example, I can expose an API running on port &lt;code&gt;3000&lt;/code&gt; with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx portpreview 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API can then receive external requests without being deployed. This is particularly handy for services that need to send requests back to my machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tunnels and preview deployments serve different jobs
&lt;/h2&gt;

&lt;p&gt;I still use preview deployments when a team needs a stable environment or when the app must stay online independently of my computer.&lt;/p&gt;

&lt;p&gt;A preview deployment looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;code → commit → push → build → deploy → test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A local tunnel is shorter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;code → localhost → test
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a quick test, I usually prefer the second workflow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using a permanent subdomain
&lt;/h2&gt;

&lt;p&gt;After trying the random tunnel URL, I wanted a stable address for the project. PortPreview lets me reserve a subdomain and use it when starting the tunnel:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx portpreview 3000 &lt;span class="nt"&gt;--subdomain&lt;/span&gt; my-project &lt;span class="nt"&gt;--token&lt;/span&gt; pp_live_...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives the project a predictable URL instead of a new random address each time. I can also save the token instead of passing it with every command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx portpreview config set-token pp_live_...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After that, starting a tunnel takes one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx portpreview 3000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My normal workflow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Run the React app
      ↓
npx portpreview 3000
      ↓
Open the public HTTPS URL
      ↓
Test on a real device
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When a project needs a stable URL, I use the reserved subdomain. Once the initial setup is done, exposing a local app is a one-command job.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;There are plenty of established tunneling tools, and no single option will suit everyone. For my React workflow, I wanted as little friction as possible: start the app, run one command, get an HTTPS URL, and open it on a real device.&lt;/p&gt;

&lt;p&gt;The permanent free hostname also solves one of the more irritating parts of using temporary tunnels regularly.&lt;/p&gt;

&lt;p&gt;If you're dealing with the same problem, take a look at &lt;a href="https://portpreview.com/" rel="noopener noreferrer"&gt;PortPreview&lt;/a&gt;. I'm also curious what other developers use for local React testing and webhook development.&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>tunnel</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
