TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Does using React Native and React really help cross-platform code reuse?

3 pointsby sazaryabout 9 years ago
Hi<p>We&#x27;re planning to release a MVP for a product that needs web, iOS &amp; Android front ends, and they have some similar components in them.<p>My question is, if you have any first hand experience using React for creating your web front end &amp; React Native for your mobile apps, did you find code reuse between these platforms easy? Was it something happening routinely? I know that <i>theoretically</i> it is possible to reuse some codes between them, but is it <i>easy &amp; common to happen in practice</i>?

2 comments

brudgersabout 9 years ago
The description I&#x27;ve heard on Software Engineering Daily is that React and React Native are more &quot;learn once, use everywhere&quot; than &quot;write once, run everywhere&quot;. That is the important productivity goal is related to programmer knowledge, skill, and ability rather than lines of code.<p>Keep in mind that React and React Native are from Facebook and reflect its needs not necessarily those of a single developer or small shop. My understanding is that for Facebook, the problem React and React Native address is allowing feature based teams rather than platform based teams. For example, the new &quot;like&quot; button could have Web, Android, and iOS developers all sitting together sharing a common language while still developing on somewhat divergent code bases.<p>That&#x27;s not to say that one way data flow isn&#x27;t useful. But there&#x27;s still still no silver bullet.<p>Good luck.
评论 #11471845 未加载
jankorabout 9 years ago
Well, yes it is possible and there are development stacks that support it (Este). You will not be able to reuse visual components as native renderers to native components and react to html, but you can go around it by abstracting your UI and implementing two UI libraries (native, web) with the same API. Then you will be able to reuse most of your code.<p>Technically I think it is possible to achieve a decent amount of code reuse, but I feel product requirements usually require different functionalities that might make code reuse more difficult, ie. user input touch&#x2F;swipe vs click.