Installation
An overview of how to install and use React Native for Web.
React Native for Web can be used for multi-platform and web-only applications. It can be incrementally adopted by existing React Web apps and integrated with existing React Native apps. Preact is also supported.
npm install react-dom react-native-web
The Babel plugin is recommended for build-time optimizations.
npm install --save-dev babel-plugin-react-native-web
Quickstart
Expo
Expo is a framework and a platform for universal React applications. Expo for Web uses React Native for Web, provides dozens of additional cross-platform APIs, includes web build optimizations, and is compatible with the broader React Native ecosystem. See the Expo docs for more information.
Create React App
Create React App is a basic way to setup a simple, web-only React app with built-in support for aliasing react-native-web
to react-native
. However, it’s generally recommended that you use Expo.
npx create-react-app my-app
cd my-app
npm install react-native-web
npm start