DEV Community

Cover image for React (Native?) project
Bram Hammer
Bram Hammer

Posted on

React (Native?) project

React Native for web?

At the moment we are migrating our Symfony only project to React frontend and symfony backend and plan to extend our platform with a React Native app for Android and IOS.

All is progressing as we would like, no issues so far and we're actually on track... However; this evening I started thinking why only reuse certain components (partially) if we can maybe reuse over 95% of the code or maybe 100%!?

Outdated or no clear examples

So I went online and did a little research to see if it would benefit us to make the web app also in React Native... Sadly enough there's no clear answer and quite a bit of information is outdated..
At this point I want to hear some opinions or even better, real examples of why you should or shouldn't do this?

I saw some options using expo or React Native Web etc..

But I want to hear your opinions and experiences!


Header image: Hackr - React vs React Native

Top comments (4)

m4rcoperuano profile image
Marco Ledesma • Edited

I think a good approach is to use web specific frameworks for the web, and react native for the mobile app. Both can share renderless components, however. Imagine a component that handles data fetching for a drop down - there is no reason that couldn’t be a function outside of a component, or better yet- a renderless component - allowing you detach the functionality of that component from its UI.

The goal is to share as much functional code as possible, while keeping the UI separate

brampayrequest profile image
Bram Hammer

Totally agree! I was just very curious on the people that did do this.. what was their reason and was it worth it.

We write our react web app keeping in mind that we use certain elements (as much as possible, when desired or beneficial) for both apps. And now that I think about it..
Having one code for Android, iOS and web (for phone, tablet and desktop/tv) would maybe add more problems then it would solve indeed...

Well... Let's time to continue our work on the web app haha..

andrewbaisden profile image
Andrew Baisden

Personally if it was me I would develop the web version using React and the mobile version using React Native. The codebases are almost the same so it should not be too hard to replicate the mobile design in the browser. It's also much safer because the React community is massive. It could be more complicated to use React Native in the browser because as far as i'm aware it's not that common to do that sort of thing.

So you could run into problems and then you would most likely just have to go with React for the web anyway. That's my take on it.

brampayrequest profile image
Bram Hammer

Like I replied to marco. You're correct, after thinking about it some more it would add a whole other set of problems instead of solving a few(less important ones)..

So time to finish our web app haha