我们可以在 react webapp 和 react native app 之间共享代码吗? [英] Can we share code between react webapp and react native app and is react-native production ready

查看:68
本文介绍了我们可以在 react webapp 和 react native app 之间共享代码吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个用 reactjs 开发的小部件的稳定版本.我们想开发相同的移动版本.是使用 react native 进行开发并在 2 个应用之间共享代码更好,还是我们本地开发小部件更好.

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 across the 2 apps or is it better we develop the widget natively.

请记住,我们在两者(react 和 android 开发)方面都拥有专业知识,但我们不想在再次开发整个应用程序上投入太多时间.

Bare in mind that we do have expertise in both(react and android dev) but we do not want to invest to much time on developing the entire app again.

如果我们选择 react-native,是否有任何工具/资源可以更快地完成这项工作?

Are there any tools/resources available to get this done faster if we choose react-native?

在线可用资源:

http://jkaufman.io/react-web-native-codesharing/

https://arielelkin.github.io/articles/why-im-not-a-react-native-developer.html

https://medium.com/@felipecsl/thoughts-on-react-native-from-an-android-engineers-perspective-ea2bea5aa078

干杯!!!

推荐答案

Instagram、特斯拉、AirBnB、Di​​scord、Bloomberg 都有用 React Native 编写的生产应用程序.我会让你自己决定它是否在你看来可以生产.

Instagram, Tesla, AirBnB, Discord, Bloomberg all have production apps written in React Native. I'll let you decide for yourself whether it's production-ready in your opinion.

虽然 React Native 使您能够在 iOS 和 Android 之间实现重要的代码重用(我们目前正在为客户端构建一个应用程序 - 从外部库中提取 - 在 iOS 和 Android 之间重用超过 99% 的代码),但它并非旨在共享代码使用 React 网络应用程序.

While React Native enables you a significant code reuse between iOS and Android (we are currently building an app for client which - appart from external libraries - reuses over 99% code between iOS and Android), it is not designed to share code with React webapps.

Facebook 的 React Native 哲学不是一次编写,随处运行,而是一次学习,随处编写.

The Facebook's philosophy with React Native, instead of write once, run anywhere is rather learn once, write anywhere.

您绝对可以使用您的设计和架构,但您需要重写大部分代码.不过,它可能仍然比开发两个单独的 Java 和 Obj-C/Swift 应用程序更有效.

You can definitely use your designs and architecture, but you would need to rewrite most of the code. It might still be more efficient than developing two separate Java and Obj-C/Swift apps, though.

更新: 2018 年,Airbnb 决定在其生产应用中停用 React Native.他们写了一篇关于他们的经验和推理的有见地的文章.对于任何考虑使用 React Native 的人来说,这都非常重要.https://medium.com/airbnb-engineering/react-native-at-airbnb-f95aa460be1c

Update: In 2018 Airbnb decided to sunset React Native in their production apps. They wrote an insightful article about their experience and reasoning. It is very relevant for anyone thinking about using React Native. https://medium.com/airbnb-engineering/react-native-at-airbnb-f95aa460be1c

这篇关于我们可以在 react webapp 和 react native app 之间共享代码吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆