News for hackers. Stuff that matters.
Re:No, React Native is not the future by ramesh31 on Saturday December 31, 2022 @08:33PM (#34202660)
> But your react logic is still executing as JavaScript.

Yes, but this is no different than how native works. On iOS, The JS Bridge compiles to bytecode and talks to the Obj-C runtime for native needs like Cocoa, just as Swift does.

Sure you could get better performance by writing your apps in C, but I don't think many people want to go back to those days.

Re:No, React Native is not the future by foreverCarlos on Saturday December 31, 2022 @09:01PM (#34202824)
I don’t think many people left those days TBH. I personally saw how 2 large RN efforts have been rolled back to native at a big tech company. I don’t know whether RN is gaining traction or is stagnating - would love to see some stats.
Re:No, React Native is not the future by acchow on Sunday January 01, 2023 @04:40PM (#34211255)
You mean Facebook sized large? Not every company has the resources to hire a full on Android and iOS team. So they write React Native instead, which is good enough for most.
Re:No, React Native is not the future by t3rra on Saturday December 31, 2022 @09:34PM (#34203006)
You have no idea. Swift is compiled into native code on build time
Re:No, React Native is not the future by dlivingston on Saturday December 31, 2022 @11:19PM (#34203563)
Sorry... what? The more I read this, the more asinine it sounds.

Some definitions:

- The Obj-C runtime is just a shared library that Swift links to on compilation (/usr/lib/libobjc.A.dylib). The performance to call into it is identical for Swift and Obj-C.

- "Sure you could get better performance by writing your apps directly in Obj-C..." Swift code is native code. Cost to access the runtime is identical.

- There is one "hop" to go from Swift to the Obj-C runtime.

- There are >2 "hops" to go through the JS Bridge. https://hackernoon.com/understanding-react-native-bridge-con...

Re:No, React Native is not the future by claytongulick on Saturday December 31, 2022 @11:50PM (#34203704)
> the more asinine it sounds.

HN is better without personal attacks and insults.

Re:No, React Native is not the future by zapzupnz on Sunday January 01, 2023 @02:58AM (#34204541)
The comment was against the argument being made, not the user. Nothing personal about it.
Re:No, React Native is not the future by claytongulick on Sunday January 01, 2023 @04:19PM (#34211030)
That's an interesting take that I don't agree with.

It could be extended to pretty much anything: "I'm insulting your clothes, not you".

Calling something that a person says, or writes "asinine" is inflammatory. If I were to call your defense of it "naive, brain dead and utterly absurd" are you sure you wouldn't interpret that as a personal attack?

Re:No, React Native is not the future by zapzupnz on Sunday January 01, 2023 @09:18PM (#34213461)
> Calling something that a person *says or writes* "asinine" is inflammatory

Yes, inflammatory. But personal, no.

> If I were to call your defense of it "naive, brain dead and utterly absurd" are you sure you wouldn't interpret that as a personal attack?

Correct, because it's not personal. That would be attacking the quality of the argument, not me, although it would certainly be inflammatory. I certainly wouldn't take it well — but for a totally different reason than you originally specified.

"Personal" and "inflammatory" are two different things.

Re:No, React Native is not the future by pixel_tracing on Sunday January 01, 2023 @03:43AM (#34204735)
I’m sorry what?? Native code gives you access to libdispatch and concurrency. RN is single threaded. There are a myriad of processes, shared memory, optimizations, and daemons that run on your phone that coordinate better with native binaries.

Web won’t beat native on mobile phones, I’m sorry this argument has been had every single year it’s just absurd we keep arguing about it.

RN is implemented due to developer productivity at the cost of user experience. Which is fine more power to you, but understand that it doesn’t imply better UX.

The barriers to creating apps is also getting smaller (SwiftUI & Jetpack Compose).

Source: Multiple years working on Core Apple systems at Apple and also multiple years at Google

Re:No, React Native is not the future by dmitriid on Sunday January 01, 2023 @05:55AM (#34205347)
> Web won’t beat native on mobile phones

Honestly, it won't beat anything anywhere, but people do keep on trying to make it work.

Re:No, React Native is not the future by acchow on Sunday January 01, 2023 @04:43PM (#34211295)
Objective-C actually gets compiled down to machine code at compilation down. When you download an app from the app store, there is no more Objective-C.

RN doesn't "compile" the Javascript to bytecode or machine code. Instead, the closest competition you could get from RN is a JIT. But AFAIK iOS doesn't allow a Javascript JIT to run, so the JavaScript running is not being JITed to Bytecode.

Even if you assume that iOS allows a JS JIT now, you still have a JavaScript->Native bridge to cross. This adds a performance hit that Objective-C does not have.