React-native和React [英] React-native and React

查看:113
本文介绍了React-native和React的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个webapp和ios / android(相同的应用程序)。起初我认为cordova可能是一个不错的选择,然后阅读后我认为React-native可能是更好的选择。

I'm building a webapp and ios/android (same app). At first I thought cordova may be a good choice then after reading I thought React-native may be a better choice.

我的问题是:我是否必须写相同的应用程序两次(一个针对网络做出反应,另一个针对移动设备做出反应)?

My question is: Will I have to write the same app twice (one in react for web and one in reactnative for mobile) ?

我见过一些可以共享网络反应本机组件的库,但我觉得我我会受到限制。

I've seen some library that can share react-native component for web but I feel I'm gonna be limited.

你怎么看?

编辑:还有一个问题
有了反应我会使用flux(现在可能是redux)我该怎么办才能保持我的react-native应用程序的清洁和可读性,我的意思是我应该如何在那里管理数据?谢谢你的答案

One more question With react I would use flux (and probably now redux) what should I do to keep my react-native app clean and readable, I mean how should I manage data there ? thanks for your answers already

推荐答案

React native使用原生视图UIView,Text等进行显示。您不能拥有相同的代码库。
React native使用flex box(它有自己的实现),因此也不适用于web反应项目。

React native uses the native views UIView, Text etc for display. You can't have the same code base for them. React native uses flex box( it has its own implementation) so that also wont work for web react projects.

唯一的方法是保持它们分开。 Web和App也有不同的设计。

The only way is to keep them seperate.Also Web and App would be having different design .

这篇关于React-native和React的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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