When I started at my current company we had to release an MVP for iOS, Android and Web in under three months. For iOS and Android ofcourse we went with React Native and in order to move fast I decided for the web app I will use React and share as much code as possible between the two using a monorepo system.
I decided to use react-native-web which allowed us to share UI code between the two as well and subsequently share more than 90% of the code. This approach allowed us to save a lot of development time which would be spent on coding a separate web app.
I will show you in this tutorial how you can do that.
Project Files
https://github.com/saadibrahim/universal-react-app
Useful Links
- React Native Web
- Yarn Workspaces Documentation
- Dummy API
- Create React App
- Blog post talking about invalid hooks call warning
- How to import files from outside of root directory with React Native Metro bundler