How to add React Native Web to an existing React Native project
React Native for Web allows you to make your React Native application available for your users through the web.
The official react-native-web docs cover a few different methods like using expo
or create-react-app
. This post covers the most customizable method of adding web support to a plain React Native app using webpack
and react-native-web
.
If you prefer watching a video, I’ve gone through the steps below in this 4-minute video:
Alternative Methods
There are a few different ways you can get your React Native project running on the web. This post covers using custom webpack
configuration. However, if you’d like to explore a simpler solution with a pre-configured webpack, below you can find some alternative ways:
- Initialize with Expo or use
expo-cli
If you’ve initialized your project with Expo, it already comes with React Native for Web pre-configured.
Otherwise, you can find instructions on addingexpo-cli
to your existing react-native project following the…