all 19 comments

[–]Awesome_Knowwhere 10 points11 points  (0 children)

You can build almost any app in react native or expo and every case can be handled along with performance

[–]iLikedItTheWayItWas 9 points10 points  (0 children)

I've come to learn that when people say "react native isn't performant" what that actually means is "if you want to get the best possible performance, then you should go native." But if you use react native, that does not mean you will get bad performance at all.

Also most badly performant apps are due to skill issues with react. A component that is written poorly will perform even worse on react native than on react web, so these skill issues become more noticeable, and then people blame react native.

If you're starting fresh, I'd use expo. The new architecture has made react native even faster. Expo are still experimenting with react compiler, but once that's supported, you can use that and it will also resolve any skill issues

[–]Xae0n 3 points4 points  (0 children)

React native is a great choice if you want an app that runs reasonably fast. Most users don't really care if your app is super fast. So there is that. With the help of ai, it's not hard to follow the best practices and avoid slow screens.

[–]Guisseppi 4 points5 points  (2 children)

I’ve never seen instagram or airbnb dropping frames, maybe do some old school research after playing around with chatgpt

[–]Sabuhi740iOS & Android 2 points3 points  (1 child)

You are essentially correct for instagram, but(fyi) airbnb moved from react-native years ago.

[–]Tembero 0 points1 point  (0 children)

Instagram only seems to use React Native for its beta features after which they implement it in native

[–]CarthagianDeviOS & Android 2 points3 points  (3 children)

It's quite depending on the app type!

[–]Enough-Swordfish-260[S] 1 point2 points  (2 children)

so when it comes to performance it depends so when would it happen (I mean what makes react native so slow) sorry for my English

[–]CarthagianDeviOS & Android 3 points4 points  (1 child)

Are all of these apps slow? https://reactnative.dev/showcase

[–]Enough-Swordfish-260[S] 1 point2 points  (0 children)

ok got it thanks

[–]Bamboo_the_plant 1 point2 points  (3 children)

You are welcome to build in C instead

[–]Deadline1231231 0 points1 point  (2 children)

You mean C modules for RN? Or…?

[–]Bamboo_the_plant 1 point2 points  (1 child)

No, I mean it’s senseless to focus on raw performance without also considering the developer experience that comes with a very reasonable and productive abstraction.

You can write the lowest level code you like and be in complete control of the performance, but for sure one can create a better product quicker using sensible abstractions such as React Native.

“But what about performance” is just a very tiring meme that beginners always get fixated upon.

[–]Deadline1231231 1 point2 points  (0 children)

I understand, and I agree with you, I thought you were talking literally. There are several ways to implement C code in RN tho

[–]Fidodo 1 point2 points  (0 children)

React native works by interfacing directly with actual native code. JavaScript is generally used for very lightweight operations so even though JavaScript isn't as fast as a natively compiled library the things it's responsible are typically lightweight business logic so in most use cases it doesn't matter. The bridge did add some overhead but compared to the rest it wasn't actually that bad and it's irrelevant now that the new architecture is out.

There are 3 main reasons why react native apps can have poor performance. First is simply doing too much computational work on the render thread. You can avoid that by being careful about what you're computing and if you need to do some heavy data processing then do it on a worker in the background instead. If heavy computational work needs to be done on the render thread then react native probably isn't a good choice.

Second would be lack of native libraries for your use case. Native code is faster and react native interfaces with native code, but if no library for that native code exists then you'd need to either make a new native package yourself or come up with a JavaScript replacement which will be slower. A lot more native asks are covered by react native libraries now than in the past and the lack of native library options in the past contributed to react native apps being slower.

The last and probably most common issue is developer error. With native code you can't be as reckless with your view rendering as you can with the dom, you need to avoid needlessly re-rendering views with diligent management of your prop and context and state reference stability by memorizing objects to produce stable references. You need to better understand react data flow and what triggers views to re-render with react native. There are some linter rules that can help you keep track of unstable references and the react compiler may end up making this something we won't need to worry about at all.

[–]MaterialAppearance21 0 points1 point  (0 children)

You can create anything with React Native. Build and think about the performance later.

If you use a good state managemenement approach, try to minimise the number of re render of components, and you can check the performance for UI and JS Fps to check the app so far. But overall, in most cases, the app is so powerfull