Live data from Hacker News

With React Native it’s not all sugar and spice

blog.addjam.com

41–45 of 45 posts

Re: With React Native it’s not all sugar and spice

#41
post #2

I find irrelevant gifs embedded in a blog post like this make the entire article unreadable. It's distracting and annoying.

Here, have a bookmarklet I wrote to hide them so I could read articles like this:

javascript:(function (){var x = document.getElementsByTagName("img");for (i = 0; i < x.length; i++){x[i].setAttribute("src","");}}());

Re: With React Native it’s not all sugar and spice

#43
post #36
post #21

I'm working on an Android app. I use react-native solely for the UI which I update, redux-style, with a state-tree. The state and all it's transition and event-handling is done in Kotlin/Java. I've written a small helper that generates kotlin-Interfaces from the react/jsx-files and automatically connects everything. This way I have react's HotReload and the other benefits for UI-design and a proper typed language and…

Sounds like a great use case of React Native where RN is specifically used for what it is designed for: the UI layer. I've done apps with both approaches (all RN or UI-only RN), and I'd love to read or see more about your approach.

Maybe I'll write something longer about it, but i haven't figured everything out myself yet.

I have a Controller that takes UIEvents and NetworkEvents from a BlockingQueue (CSP). The state reduces everything. Kotlin's "when" constructs are extremely convenient here, but want to make sure I'm not going to far into the functional direction, if you get what I mean.

The state is completely serialisable (in fact gets serialised to and from JSON in onPause/onResume).

I'm doing networking declaratively as well, a serialisable request-description is put into the state and it's the "NetworkManager"'s job to figure out which requests to start or stop.

Kotlin's delegated property are also awesome, because I can mix and match functions and variables.

     /* show loading animation */
     override val isLoading by stateFn {
        it.runningRequests.any { it is LoginReq }
     }

Re: With React Native it’s not all sugar and spice

#44
post #33
post #30

Earlier quoted context omitted.

If you use react native on mobile and react on the web the core model and business logic can easily be shared since it is just pure js. And you can use any of the languages that transpiles to js: TypeScript, Clojurescript etc.

What about performance and the "overhead" that React Native might introduce?

The performance is impacted, avoiding premature optimizations I haven't looked into that part yet though. Without any performance optimizations I'm experiencing performance better than HTML5 but not really on par with native. To me the value of sharing the logic and the crazy fast development speed is more valuable than a few milliseconds of delay. At least in this stage.

Re: With React Native it’s not all sugar and spice

#45

If you're looking for an all-in-one development environment, my team is building an IDE specifically for React Native. It's free and open source. Deco IDE https://www.decosoftware.com/ https://github.com/decosoftware/deco-ide

I'd like to use it! But it's not available for Linux (oh, the irony).
Post reply on HN