
Ask HN: Does using React Native and React really help cross-platform code reuse? - sazary
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>?
======
brudgers
The description I've heard on Software Engineering Daily is that React and
React Native are more "learn once, use everywhere" than "write once, run
everywhere". That is the important productivity goal is related to programmer
knowledge, skill, and ability rather than lines of code.

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 "like" button could have Web, Android, and iOS developers all sitting
together sharing a common language while still developing on somewhat
divergent code bases.

That's not to say that one way data flow isn't useful. But there's still still
no silver bullet.

Good luck.

~~~
sazary
Thank you.

When you say it reflects needs of facebook, do you mean it won't help a team
of 2 to do web & mobile front ends? Do you think going fully native (I mean
java & swift) is easier?

~~~
brudgers
1\. I do not mean that.

2\. Depends on the team and the project.

------
jankor
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.

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/swipe vs click.

