Hristo Torbov
Hristo Torbov

Reputation: 55

Exporting React Native app for web (HTML/JavaScript)?

I’ve built a small app with React Native and it looks awesome, but I was wondering - can I just export it for web (HTML/JavaScript) instead making a separate code in ReactJS for it? And if it’s possible, what are the pros and cons? BTW I used a free UI kit for the developing. Thanks!

Upvotes: 5

Views: 5002

Answers (2)

Amir Mehrnam
Amir Mehrnam

Reputation: 535

You can use Expo to build for any platform: IOS, Android, Web
For the web, you can use expo build:web
It creates a production ready static bundle in the web-build/ directory
Here is the full document for the web

Upvotes: 1

Maycon Mesquita
Maycon Mesquita

Reputation: 4590

You have two options:

  1. Use react-native-web and share 90% the same source code, between native and webapp.

    • Good for non-complex projects;
    • If your app have native/complex navigation, then it will have issues, because this can't work on web.
  2. Use web react and share some components.

    • Recommended for complex projects;
    • If you have a complex native app, share the components can be the best option;
    • bit.dev can be useful to achieve this solution.

More info: https://blog.bitsrc.io/6-ways-to-share-and-reuse-react-components-6d80e2fd16cd

Upvotes: 4

Related Questions