Can we share code between react webapp and react native app and is react-native production ready

后端 未结 10 1407
终归单人心
终归单人心 2021-02-01 07:11

We have a stable version of a widget developed with reactjs. We would like to develop mobile version of the same. Is it better to develop with react native and share the code ac

10条回答
  •  無奈伤痛
    2021-02-01 07:36

    Two popular options addressing code share across web, iOS, Android & Windows are

    1. React Native Web - https://github.com/necolas/react-native-web
    2. ReactXP - https://github.com/microsoft/reactxp

    Below is an excellent excerpt from https://microsoft.github.io/reactxp/docs/faq.html highlighting the difference.

    How does ReactXP differ from React Native for Web?

    React Native for Web is an open-sourced library developed by engineers at Twitter. We started implementing ReactXP before React Native for Web was available.

    The goals behind these two efforts are similar, but the approaches differ. ReactXP is a layer that sits on top of React Native and React, whereas React Native for Web is a parallel implementation of React Native — a sibling to React Native for iOS and Android.

    ReactXP generally exposes only those props, style attributes, and APIs that are available across all platforms. If you write to ReactXP’s abstraction, you can have high confidence that it will run on all supported platforms in the same manner. The same can be achieved with React Native for Web/iOS/Android, but you need to be more careful about which components, props, and APIs you use.

提交回复
热议问题