惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
P
Privacy International News Feed
P
Proofpoint News Feed
Security Archives - TechRepublic
Security Archives - TechRepublic
C
CXSECURITY Database RSS Feed - CXSecurity.com
Know Your Adversary
Know Your Adversary
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Attack and Defense Labs
Attack and Defense Labs
NISL@THU
NISL@THU
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
W
WeLiveSecurity
GbyAI
GbyAI
N
News and Events Feed by Topic
N
News | PayPal Newsroom
Y
Y Combinator Blog
C
CERT Recently Published Vulnerability Notes
N
Netflix TechBlog - Medium
S
Security Affairs
Spread Privacy
Spread Privacy
罗磊的独立博客
腾讯CDC
MyScale Blog
MyScale Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
L
LINUX DO - 热门话题
The Cloudflare Blog
L
LangChain Blog
博客园_首页
H
Hacker News: Front Page
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
博客园 - 聂微东
SecWiki News
SecWiki News
A
Arctic Wolf
爱范儿
爱范儿
Google Online Security Blog
Google Online Security Blog
T
Threat Research - Cisco Blogs
Hacker News - Newest:
Hacker News - Newest: "LLM"
有赞技术团队
有赞技术团队
The GitHub Blog
The GitHub Blog
Cyberwarzone
Cyberwarzone
博客园 - 叶小钗
V
Visual Studio Blog
V
V2EX
T
Tailwind CSS Blog
Project Zero
Project Zero
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
MongoDB | Blog
MongoDB | Blog
D
Docker

ashishb.net

A day in Luxembourg - the richest country in the world I was asked to install malware during a fake interview Book summary: Breakneck - China's quest to engineer the future by Dan Wang Book summary: How to Teach Your Baby to Read Book Summary: The Discontented Little Baby Book by Pamela Douglas Introducing Amazing Sandbox - run third-party tools and AI agents securely on your machine Why software outsourcing gets a bad reputation? Book summary: The Natural Baby Sleep Solution by Polly Moore A day in Antwerp, Belgium Journey of online influencers Two days in Brussels, Belgium Shortcuts - when we love them and when we don't A visit to Rakhigarhi Three days in overhyped Paris Empty Japan, crowded Tokyo The real lock-in in GitHub is not the code, but the stars 11-day Norwegian Breakaway East Caribbean cruise Sanskrit and Sri Lankan Air Force Use REST with Open API The Achilles heel of American capitalism Costa Rica in 4 days At a juice stall in Sri Lanka A short stay at Warsaw, Poland Best practices for using Python & uv inside Docker Two days in Vilnius, Lithuania How IntelliJ IDEs waste disk space Pregnancy Why there aren't many digital nomads from India Two days in Riga, Latvia To keep your machine secure, run third-party tools inside Docker Family Ties in Your DNA: Some relatives are closer than others Doctors per capita Two days in Tallinn, Estonia Ship tools as standalone static binaries Made in America Two days in Helsinki, Finland Maintaining an Android app is a lot of work The land of good deals Two days in Oslo, Norway FastAPI vs Flask performance comparison Google Search is losing to Perplexity Two days in Dublin, Ireland Continuous integration ≠ Continuous delivery World's simplest project success heuristic London in 5 days It is hard to recommend Python in production Inflation, IRS, Credit cards, and Vendors Temu and the Chinese approach Things to do in Miami Florida Revenue vs Cost Axis Language learning as an adult The unanchored babies of the green card limbo Price variance in the United States A day in Louisville, Kentucky A surprisingly positive experience with Air India Unhospitable Airports Android: Don't use stale views USA = Union of Sales and Advertisement A day in Nashville, Tennessee Minimize Javascript in your codebase A day in Birmingham, Alabama In defense of ad-supported products Real vs artificial world The science behind Punjabi singers Hiking Mt. Fuji The Indian startup bubble is insane Repairing database on the fly for millions of users Book Summary: One up on Wall Street by Peter Lynch It is hard to recommend Google Cloud At the Prague airport Kyoto in three days Migrating from WordPress to Hugo Book summary: Sick Societies by Robert B. Edgerton Statistical outcomes require statistical games Illegal immigrants to Europe via Cairo Tokyo in three days Mobs are Status Games Writing Script matters as much as the spoken language Sri Lanka in 5 days LLMs: great for business but bad business Book Summary: Safe Haven by Mark Spitznagel Mac shortcut for typing Avagraha symbol On a bus with an asylum seeker Nicaragua in 5 days When to commit Generated code to version control Why I always buy a local SIM in a foreign country Use Makefile for Android Four days in Guadalajara, Mexico Android Navigation: Up vs Back Hotels vs Airbnb vs Hostels Currency issues in Argentina Abstractions should be deep not wide Some data on podcasting Always support compressed response in an API service A day in El Calafate - Patagonia, Argentina Hermetic docker images with Hugging Face machine learning models American Elections The sound of "ch" API services should always have usage Limits Hiking in El Chaltén - trekking capital of Argentina
React Native
Ashish Bhatia · 2021-03-07 · via ashishb.net

There are tons of hyped-up claims surrounding React Native that are worth addressing.

The reasons why companies run for React Native are usually,

  1. We already use Javascript for the website and now, we can build apps in that as well.
  2. We can use one codebase for Android, iOS, and web apps. Or at least, Android and iOS apps.
  3. Facebook uses it

We already use Javascript for the website

Let’s address the first claim. Yes, you can indeed use Javascript for building your mobile app. But it is just a dressing on top. Underneath, you are using various React Native libraries that contain Java code to integrate with the Android framework. That leads to a few problems.

One is that you will see crashes/bugs in the React Native library that you imported and you will have to go in and fix it. So, the Java code is never invisible. Secondly, Android has tons of helper libraries like AppCompat, AndroidX, Arch, etc. As soon as you introduce a layer of indirection in terms of accessing them, you are dependent on the author of those libraries to fix it.

Another problem that happens is that cross-language error handling is hard. If the underlying system throws a checked exception, how is that supposed to be propagated back to Javascript which does not have a concept of checked exceptions? What about unchecked exceptions? What if they aren’t even documented? This can lead to the program entering unexpected states and appearing unresponsive.

The third major problem that happens is this magical belief that because you are using Javascript, it is the same platform. Javascript was meant for adding dynamic components to HTML pages. Not to run background tasks on long-running mobile apps. Many websites cannot handle intermittent connectivity drops while loading. And that’s acceptable since the users are used to refreshing a web page. Mobile apps are expected to work differently. Even more so, on both platforms, Android and iOS, one can do limited background work, albeit with a different set of restrictions. Javascript isn’t even multi-threaded and that leads to performance issues. Over time, as you start building more and more features, you realize that you still have to learn the underlying platform alongside an extra Javascript library. For example, say you want to build an Android Auto integration in your app, you will have to understand what Auto APIs’ capabilities are apart from finding a React Native library to integrate with.

We can use one codebase for Android and iOS

You can indeed use a single codebase to write Android and iOS. And probably even backend code as well, just have different code paths and trigger different parts of the code. But that’s not code sharing. It is more akin to doing a sack race where a strong amount of coordination is required. That’s what Airbnb experienced. While a single codebase means that you can build new features and fix bugs in a single place, it also means that one would have to test on both Android and iOS simultaneously. And what about Android fragmentation? or even iOS fragmentation? What if the UI library that you used has a bug on a certain version of a platform? Consider all the bugs Android and iOS frameworks have. Now, add all the bugs that React Native has. Your surface area of hitting a bug has only gone up. That’s one of the critiques Steve Jobs had of Flash-based apps.

Facebook uses it

Let’s look at the final claim that Facebook uses it. Only a small fraction of the Facebook app and that too non-crucial features are written in React Native. Other companies like Udacity and Airbnb tried and gave up on React Native. Dropbox tried a common C++ layer for Android and iOS gave up as well. Discord faced tons of performance and battery drain issues as well. If all these well-funded companies had a tough time making React Native work, ask why would it succeed in your case.

Other concerns: Security

One thing that many don’t realize is that React Native packages come from NPM. And that’s a security mess. Of course, it matters less if you are building a music player but if you are building finance or a cryptocurrency app, it is a matter of time before you will be targeted. And this matters more to React Native apps than native apps. The native apps might depend on some external packages as well. But the React Native app will depend on third-party packages for even trivial functionality such as writing to disk. And npm packages themselves suffer from dependency bloat.

Other concerns: Backward compatibility

As of Jan 2021, the latest version of React Native is 0.63. It is less than 1.0 to indicate that the APIs have not stabilized even after 6 years. So, who pays if the API is unstable? And what if you want to use two libraries that were built against two incompatible versions of React Native? Or one against AndroidX and another against deprecated Android’s AppCompat?

When to use React Native

So, what are good cases to use React Native? When your app does not use the contact book, system notifications, compass, or any other system-specific feature. In that case, also, consider building a good quality web app instead and let users install it as PWA.