Building a React Native app can be tricky. We will share tips and tricks to help you and other react native developers on a real project.

  1. Be confident in your abilities

 Remember, the world of React Native is a lonely world for now. You may find yourself in a situation that no one has encountered until now, and even Google will not help you. Always use a version control system (VCS) and commit your changes regularly (all the "serious guys" call this process Continuous Integration). This will help you quickly get back to your last working copy without wasting time or code.

Therefore, it is very important to understand what you are doing, otherwise you can completely destroy your project. If you are not using VCS yet, it's time to get started.

    2. Update your JSC

 JSC (JavaScriptCore) is a JavaScript engine based on WebKit. It is used by React Native to convert JavaScript to machine code. Therefore, anything you write in JavaScript is still executed as JavaScript, only with JSC. Sometimes it can get in trouble with a very old version of JSC. This means that you need to use babel to convert.

JSC upgrade is very easy. This GitHub repository has all the information you need to get started with minimal downtime.

    3. Setting up Redux correctly

Redux can be problematic if not properly configured. This setting means deep integration with the application.

Use your best practices or React navigation as navigation. Using Redux for these purposes is a great solution in the long term, although the official documentation of React navigation does not encourage its use without a full understanding of all the processes. But, if you do decide to tackle this, make sure that everything is configured correctly, otherwise the application will randomly crash and crash.

    4. Use automation tools like fastlane

Fastlane is a great command line utility for automating many of the common tasks you come across. This sounds more like time optimization rather than code optimization, but it deserves its place.

    5. Error processing

Don't expect users of your app to notify you when it crashes. In many large applications, it is difficult to catch the error that causes the application to crash. You can use for this purpose. It can be included in your build process and even upload a sourcemap to your server so that you can see the actual code, and not random garbage in the logs.

    6. Debugging

Are you still using the Chrome Inspect console to debug your React Native app?

What if you want to clear the app's asynchronous storage, or force the app to stop and clear the data? Constant thoughts about these nuances only distract from active development. We recommend using the free standalone debugger for React Native.

    7. Don't use heavy UI libraries with React Native.

Because of this, performance drops dramatically, even in production. It is also not recommended to use NativeBase, although it is quite interesting from a user interface point of view. There are much more convenient options like React Native Paper.

    8. Take advantage of React Native's on-the-fly JS-bundle replacements using technologies like CodePush without re-submitting your app to the appStore. 

    9. Make sure the package-lock.json file is created (if using npm).

You will be very surprised when you accidentally delete the folder with node_modules and realize that not a single package in npm monitors semantic versioning.

    10. Maintain order in your React Native application file structure. This is very important for scaling.

Learn for more.