Giter VIP home page Giter VIP logo

Comments (5)

nathansobo avatar nathansobo commented on May 16, 2024

Hey @necolas. Thanks for the input. I'm definitely open to it. I actually did some research into react-native-web early on, but ended up deciding to just use React at first because it felt like a more trodden path and just a more basic place to start. Not exactly a super deep technical analysis.

My main concerns with react-native-web are related to support and ecosystem. Will we have access to the same features that come out on standard React? Also, I'm still not super clear on the exact problems it solves assuming we don't care about rendering on mobile. So yeah, I guess I'm interested, but to justify using something other than the mainstream React I need a really clear understanding of the benefits. The deterministic CSS stuff is interesting but seems solvable on its own. Maybe I should take a deeper look. Maybe you can help me understand your view of the trade-offs as well.

from xray.

necolas avatar necolas commented on May 16, 2024

Thanks, I've tried to answer some points below. Will close this as it was just a "have you looked at..." issue.

My main concerns with react-native-web are related to support and ecosystem

So far it's been supported for over 2 years with over 160 releases. The ecosystem is tied to the large React Native ecosystem. RNW is currently used in production by Twitter, Flipkart, Uber. Twitter is using it for desktop and mobile web UX in the upcoming replacement of twitter.com with mobile.twitter.com.

Will we have access to the same features that come out on standard React?

By "standard React" do you mean React DOM? The DOM APIs change very slowly so React DOM is pretty stable. RNW is actually built over React DOM which means you can use 'react-dom' directly if ever needed. This is how Twitter can incrementally concert components to use RNW too.

I'm still not super clear on the exact problems it solves assuming we don't care about rendering on mobile.

As mentioned above, it's not just for mobile. Other problems it solves are deterministic styles with minimal footprint, prefixed styles, built-in RTL layout support, subscribing to element layout, built-in layout measurement, accessible interactions via kb, mouse, or touch inputs (eg Surface laptop support all 3 at once). And it provides higher level abstractions for building UI than you get from the DOM. All of this is built into the framework and the component props.

to justify using something other than the mainstream React I need a really clear understanding of the benefits

Sure. Think of it more like a component library for React DOM. Your requirements are not met by React DOM, that's just a React API for the DOM. Whereas Facebook designed React Native for app developers and a lot of tools we need to build web apps are built into it. The styling alone provides guarantees, performance, and dev tools integration which most web css-in-js libraries do not.

The deterministic CSS stuff is interesting but seems solvable on its own

It's not unless you want to design and build your own library, but React Native has already done the work https://github.com/necolas/react-native-web/blob/master/website/guides/style.md#how-styles-are-resolved

In contrast, libraries like styletron have determinism issues that can be difficult to debug when components and styles are composed.

Maybe you can help me understand your view of the trade-offs as well.

IMO what you lose is relatively limited because you can use one of several escape hatches whenever needed, including using it alongside any vanilla JS or react DOM code. You buy into a stricter contract with more powerful primitives in the places you benefit from that. Most notable is no support for state in CSS - media queries, hover. In reality I think non-trivial apps benefit from this as you need to replace or update components in response to layout changes anywhere in the tree, rather than only change styles when the viewport changes.

from xray.

nathansobo avatar nathansobo commented on May 16, 2024

Thanks very much for the thoughtful reply. I will give it a closer look. The benefits you mention to indeed sound compelling to me.

from xray.

necolas avatar necolas commented on May 16, 2024

And FWIW, I understand that trying new react tools isn't the priority for xray. But as someone who understands the specific requirements of xray, I would be interested in hearing any further thoughts you have, or any issues you might identify, even if it's just exploring in your own time and not for xray. Thanks!

from xray.

cztomsik avatar cztomsik commented on May 16, 2024

This might be interesting alternative too.

It's a GPU-based (webrender) and there is absolutely no DOM or CSS involved. It's currently a subset of react-native with aim to be react-friendly cross-platform UI for desktop applications (not there yet at all).

Footprint is 50M including npx ts-node so it should be around 30M with react if precompiled.

hmr
image

from xray.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.