6

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!

2 Answers 2

4

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

Sign up to request clarification or add additional context in comments.

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.