Guides
Plan-enterprise-icon
Expo Application Services
API Reference

Develop for Web

Learn how to develop your app for the web so you can build a universal app.


If you build your native app with the Expo SDK, then you can also run it directly in the browser with Expo CLI. On web, your app is rendered with React Native for web which powers massive websites and progressive web apps like Twitter, and Major League Soccer. The Expo SDK also utilizes native browser functionality like Video, Camera, and Gestures without the need for a custom native browser.

Getting started

Install the expo package which contains the Expo CLI used for starting the dev server:

Terminal
yarn add expo

Then you can use Expo CLI to install the web dependencies in your project:

Terminal
npx expo install react-dom react-native-web @expo/webpack-config

Update the entry file

Modify the entry file to use registerRootComponent instead of AppRegistry.registerComponent:

+ import {registerRootComponent} from 'expo';

import App from './App';
- import {AppRegistry} from 'react-native';
- import {name as appName} from './app.json';

- AppRegistry.registerComponent(appName, () => App);
+ registerRootComponent(App);
Info-icon

Learn more about registerRootComponent.

Start the dev server

Finally you can start the webpack dev server with:

Terminal
npx expo start --web

You can test secure web APIs like the camera and user location by adding the --https flag to npx expo start. This will host your app from a secure origin like https://localhost:19006.

Info-icon

You can try experimental Metro web support instead of webpack.

Alternative Rendering Patterns

Info-icon

Example: The website beatgig.com uses Expo web + Next.js to achieve SSR in the browser.

By default, Expo renders your web app as a single page application (SPA). This rendering pattern is the closest to how native rendering works. If you'd like to render your Expo web using server-side rendering (SSR) or static site generation (SSG), then you should try using the Expo SDK with another tool like Gatsby, Next.js, Remix, and so on. One caveat is that these tools are less universal and require a bit more effort to share code across platforms.

The ability to use Expo web with these other React frameworks is what makes it the most powerful way to build a universal app. The possibilities are endless and you won't hit a theoretic performance wall in the future.

  • Next.js
  • Storybook
  • Preact
  • Gatsby
  • Electron
Info-icon

Alternative framework implementations are maintained by the Expo community.

Next

Publishing websites

Export your website and upload to any web host.

Arrow-right-icon
Progressive web app

Learn how to make your website run offline.

Arrow-right-icon
Responsive design

Make your website work across different screens.

Arrow-up-right-icon
  • Message-iconAsk a question on the forums
  • Edit-iconEdit this page

Was this doc helpful?