380 points · by bpierre · 10y ago · 138 comments
React Native is a variation of React, which is a framework for building UI components. It supports stateless components and stateful components. Compared to many paradigms for designing elaborate UI, React often offers lower levels of complexity and easier to understand performance characteristics.
An ecosystem around react has built up with various approaches to data storage and data flow. This project has great potential because it means that a developer can learn one set of skills and develop native quality UI for a variety of platforms.
Try building something simple (with a few components, and perhaps redux) using react, and you'll get what's interesting about it.
In React (in general) you build components out of other components. Thus react-dom contains pre-defined components named after HTML dom elements. They behave like a very standards-compliant and consistent dom implementation.
So if you want to build a name badge component in React for web, you'd define a "render" method that used the dom-oriented components.
With React-Native, there was no reason to implement a component called Div. Instead, the authors created one called View. Instead of copying the browser DOM's behavior they created simple components that are fairly direct abstractions of native UI toolkit components... Things like ListView, Modal, etc. To build something using React Native, you just compose these existing components to make your own components.
Tangent: Interestingly, you can use a library called react-native-web to render React Native components in a browser, which makes it very elegant to share code between web and mobile versions of an app. There are a few differences, but it lets your pure js components designed for native work perfectly on the web, so it's actually not a bad approach for building for the web... in some cases React Native's components contain behavior you'd end up implementing for web anyway.
Check out the tutorial here for some basic examples: https://facebook.github.io/react-native/docs/tutorial.html
Personally, I've never been able to wrap my head around Launchpad, but I haven't put any significant effort toward doing so either.
Swing drew and managed its own widgets using cross-platform Java.
React Native uses native widgets and drives them from cross-platform JavaScript.
Wonderful.
Thank you.
I think this is a good thing for shareable components, as they would have consistent spacing etc.
[0] https://github.com/tachyons-css/react-native-style-tachyons
What underlying toolkit would a Windows desktop port of React Native use, anyway? WPF? Old Win32?
Microsoft is pushing UWP as a capable desktop platform. AFAIK, they aren't ending support for their other platforms just yet. WPF is still being worked on last I heard. If you look at win10+, UWP is a perfectly valid choice for React Native. You could have React Native targets for WPF, win32, etc etc if you wanted.. I'm not sure what use cases could benefit from that though.
Keep in mind, if they're missing something in UWP that they need for React Native, they can add it to UWP.
This is a pretty fragile ecosystem. Yesterday I saw one colleague having build problems from a Maven project because one dependency changed hosts. Seemingly an easy fix, however in the new host they didn't include the version used by this specific program. My colleague ended up blindly using a newer version that seemed to work, however this is pretty fragily.
Bad from a security point of view, too.
Linux distribution packages are digitally signed and reviewed.
And an issue for it has been open since Jan 2015:
https://github.com/node-forward/discussions/issues/29
It's, imo, negligent.
Package things up, and the community complain about that instead.
You're right that the development experience is nothing like "real" native. It's using lots of web tech so it's never going to feel like Java or Swift, however, that comes with its own advantages such as code reuse and libraries.
I'm actually really impressed with the quality of the apps you can create with it. They feel native and feel really smooth, but you need to be aware of the limitations. The major one is that the apps are essentially single threaded so you need to be aware what work you're doing to avoid UI stutters. That does make it less suited for very data heavy apps, but you can work around it if needed.
Overall, as a "real" native developer I'm pleasantly surprised.
[1] https://facebook.github.io/react-native/docs/native-modules-...
[2] https://facebook.github.io/react-native/docs/native-modules-...
- If you are web developer, easy to switch to this (duh!)
- The "React" philosophy of "diffing" and pushing changes and having a virtual DOM
- Javascript - less boiler plate and easier to write (YMMV)
But, with RN you hit the limits in some spots:
- Handling navigation. The available navigator components are difficult to work with. The idioms are little sticky. I know they've started working on a new one
- With Android SDK, you have the full set of components available and hence more choices - components, Material themes etc.,
- Because of the above point, you are always ahead, unless you have bandwidth to write wrappers for new components/ changes
- Slightly noticeable lesser frame rates compared to native. I don;t think this is a deal-breaker though.
Overall, the RN team is doing a great job by bringing the well tested RN concept to the mobile world and making "reusable code" worth an attempt. The choice depends on one's requirements and technology choices available in the project etc.,
Despite that, it's nice to read a positive feedback :)
The Julia websites has a benchmark for various languages performing some tasks. Javascript seemed pretty comparable to Java.
Can you use service workers with react native?
.. or Lua, or Bash, or Qt, or Love, or Unity, or Tcl/Tk, or C/C++, or .. anything else that this is now sitting alongside, 'in the stack of usable components'.
Its good for web developers. But in the 'native application' realm, there are .. frankly .. a lot of better ways to do user interfaces than the franken-nightmare that supports the gloss...
I'd consider Swift to be native, but Java generally not. You can compile Java to machine code, but typically people run bytecode on a VM.
But then, platform domination is always a thing, and right now its Reacts/Facebooks' thing, so onward it rolls. For my part, I'm looking forward to React wiping out every other single, similar, framework in the repo's. (I'm not.)
All this is about React Native also supporting native components in Ubuntu, namely the phone and the new desktop.
React Native has supporting tools like the packager which you wouldn't hear too much about in high-level comparisons. But when you compare targets like iOS, Android, and Windows, they are all using different javascript engines. There is a lot of platform-specific work that needs to happen before you can write native components.
Conversely, ReactDOM has the code to create/update DOM. ReactDOMServer outputs static HTML. What we used to call React.JS (or simply react) is now the combination of React, ReactDOM, and ReactDOMServer.
React (the "react" npm package) doesn't target anything.
My problems with React:
- They try to push a programming paradigm, without considering that other programmers may have different or even better paradigms.
- They put too much functionality into a single framework.
- Frameworks are a bad idea anyway. It is much better to divide functionality into self-contained libraries.
- They try to redo what the web, a huge standardization effort, is doing.
- React does not fully support all HTML/CSS constructs.
Now all of this isn't really a problem right now. But if React grows and gains more traction, then it could become a problem (just like Internet Explorer became a problem after a while).
It's just JavaScript wrappers for native UI toolkits. Much in the same way there are Python wrappers, Ruby wrappers etc. The only difference between React Native and someone else's JS bindings is that React Native makes use of a virtual view hierarchy and several other React-isms - which have absolutely nothing to do with the web except in-so-far as that they were first implemented on the web.
Yes, React Native supports an API based on the web's Flexbox API, and view styling similar to CSS - but these are applied to native views. React Native doesn't implement any rendering of its own. However, if anything this is bringing web technologies to native development, they're in no way conflicting with browsers - React Native has nothing to do with a web browser.
As I said, React Native provides bindings for native UI development. Now, whether or not you think that's a good idea is up to you. Swift and Cocoa are generally pretty good, so I can see why iOS devs might steer clear. However, the Android SDK is a complete joke, React Native is significantly more efficient to develop with.
React is in no way a layer over Javascript. React is just an API to write UIs with pluggable backends. The backend can be HTML, HTML Canvas, iOS UIKit, Android widget toolkit, Winforms, GTK, QT, etc etc. It's just a higher level API for writing UIs in Javascript. It's not a platform for application delivery. Browsers and application run times + stores on iOS/Android/Ubuntu are are platforms for application delivery.
React is not even a framework. It's just a library which you can include in your bigger framework.
> - They try to push a programming paradigm, without considering that other programmers may have different or even better paradigms.
Programmers who don't like how React works can use something else. There are lots of choices out there. Angular2, om, cyclejs, mithril, ember, backbone are some of the choices. You make it sounds as if React is a browser with a limited set of APIs.
I'm not saying React is perfect but the arguments you make are totally invalid IMO.
React and React Native are framework/libraries/whatever made by Facebook to solve Facebook engineering problems (they're cool in the way they unashamedly only open source what they actually use).
They have their own paradigms they prefer and it works well for them and many others. Why should Facebook cater to every programmer's favorite paradigm?. You could honestly say the same thing about most frameworks—do people complain Rails makes it hard to do functional programming?
While it might sound redundant, it's more about making UI layout simpler, faster, and all in all more "native".
There's already plenty of browser view-based layout frameworks, and in general they run into the same limitations (performance, lack of native components, etc). This is an alternative solution to that. Think of it as a middle ground between Xamarin and Phonegap.
I'm tired of websites trying to be apps just so they'll have a better distribution model or once in a lifetime use site that wants me to install it's app.
The fact that they are making all this with Open Source is even better.
Besides, the standard protocol bodies we know from the web today (and that many of us don't like at all) were created after Netscape or IE created the foundation upon which they work on alone.
I meant that React Native can become a replacement for the parts of the web (or just html, the web is bigger) that try to be an application inside what is essentially a document viewer.
I think the web (or rather html) is wonderful for what it was intended for - document viewing and editing (sometimes collaboratively).
Blogs, newspapers, Q&A sites and anything built around content really, should definitely still be in built using html/web , but the various SaaS products should be built using a tool built for apps.
Exactly. Therefore, in my opinion, Facebook should instead try to get the web back on track of being the application delivery standard. If this is not possible (google/apple not cooperating), they should imho give ReactNative an API that is compatible with the web. Of course, they can build their virtual dom etcetera on top of that (but it should be optional).
In the end, I do believe Facebook - as a company that can't really move fast anymore (and doesn't have to) - knows this imposes the same restriction on smaller companies by taking away their agility and maxing out developer resources for work on what used to be trivial stuff. Rationally, from Facebook's perspective, React has to serve two functions: priming and funnelling programmers into their enterprise, and suppressing development efficiency elsewhere. It's positioned very well to achieve both.
Not everything needs to be react these days, guys.
Its cross platform development of logic, with per platform development of ui.
But what are the available ubuntu UI components devs have at their hand as of today? Is it based on unity 7 or ubuntu mobile components?
How different it is for a dev from developing an electron based app on ubuntu.
I know this seems like a silly thing to bitch about but it kills my idle curiosity when I have to set aside a significant chunk of time just to get to the starting line.
https://facebook.github.io/react/blog/2016/07/22/create-apps...
The UI abstraction with libreact-core + libreact-{platform} is the holygrail for native UI development. Samsung & MS have previously committed on bring RN to Tizen & Windows.
I would love to see react-core ported to LuaJIT.
JSX was instantly understandable and desirable to me due to its close philosophical connection to MXML.
Weird.