DEV Community

Discussion on: React Devs, Why don't you use React Native for Web?

Collapse
 
benbot profile image
Benjamin Botwin • Edited

IMO, it's just like any other component system out there. It's really cool that it's basically a 1:1 mapping to the react native components, but in web we have the ability to make much more unique designs and take advantage of the whole HTML, JS, CSS world to create some iconic looking products.

Another weird issue would be having users expect your site to behave like an app on their phones because it looks like one. I could see this leading to frustration for users when the site isn't able to do something that any app is able to do, like have camera access.

Also, as someone who's worked on a couple products with React websites and RN apps, the code share between the two has always been pretty small, and while this project looks like it can help bridge that, I don't think the parts of the code that you'd really want to DRY up would be shared. For that I think graphql is a much better tool, since the retrieval and processing of data is where all the real work is done.

That being said, while I've looked into react-native-web, I've never actually used it. And sorry for being all over the place, those are just my gut reactions

Collapse
 
evanbacon profile image
Evan Bacon • Edited

👋 I'm the developer working on Expo for web. I noticed that you said you haven't actually used React Native for web so hopefully I can help respond to a few of your points.

in web we have the ability to make much more unique designs and take advantage of the whole HTML, JS, CSS world to create some iconic looking products.

Not sure what the argument is here, a react-native-web project has full access to React DOM. React Native for web with Expo also has packages like react-native-gesture-handler which enable easy access to iconic native paradigms which aren't often found in web apps.

the code share between the two has always been pretty small.

IMHO there is a lot more to an app (web or mobile) than the stateless components and data providers. Ideally a universal app would be sharing accessibility, theming, safe-area, media-queries (really anything with a context provider). Deployment related metadata, icons, splash screens, etc... The things one probably shouldn't share would be related to the larger navigation architecture, and platform input states (like hover styles).

For that I think graphql is a much better tool, since the retrieval and processing of data is where all the real work is done.

A very good point! React Native for web and GraphQL aren't mutually exclusive tools, I've noticed that lots of developers tend to use them together.

Collapse
 
benbot profile image
Benjamin Botwin

Hey man, thanks for taking the time to respond!

Let me see if I can clarify what I was saying.

Not sure what the argument is here, a react-native-web project has full
access to React DOM. React Native for web with Expo also has packages like > react-native-gesture-handler which enable easy access to iconic native
paradigms which aren't often found in web apps.

Thread Thread
 
redbar0n profile image
Magne

I think the last part of your post got MIA. :) Would be interesting to read it!

Collapse
 
darthknoppix profile image
Seth Corker

Thanks for you response, those gut reactions are good insight.
I want to see how it works first-hand and I'm going to try and play around with Expo and react-native-web soon.

You make some valid points, in my experience code sharing is very dependent on how much you want to take advantage of on native platforms. The more native it is, the more custom and less code shared.

I think the approach has worked well Twitter but their modern app/web experience is designed to be identical across all platforms - I'm tentatively excited to see for myself.

Collapse
 
redbar0n profile image
Magne

what was your experience?