Development Tips on React Native

React Native has recently gained a lot of traction. Those, looking to commission an application development, are attracted by the promise of reduced development costs and a single codebase for iOS and Android. My team has accumulated certain experience with React Native for the last couple of years. I'd like to share some general tips on what to do and what not to do if you develop with React Native in 2018.

1. Most likely you will end up using Redux. Although it is not a dogma and some alternatives like MobX exist, Redux is a de-facto standard. Given a scarcity of good React Native developers around, it is better to stick to what most of them know and understand.

2. You should use redux-saga for application "side effects". It is more important than it may seem, because from Redux point of view basically all useful things that your application does are considered side effects. Forget redux-thunk and redux-promise, learn and use sagas from the very beginning.

3. Stick to React Navigation for, er, React Native navigation. Do not mix up with react-native-navigation by Wix. The later might look easier to use, but it is ideologically less "reactive" and requires you to meddle with React Native internals on installation, which is a huge source of major headaches.

4. Don't be scared off by Microsoft logo on it and make use of TypeScript. You will get many advantages of strongly typed languages without losing JavaScript dynamic capabilities and flexibility. Do not bother with Facebook's Flow.

5. Limit the usage of third-party libraries. Think twice when you add something to the dependencies section of your package.json file. Think even more if that dependency has a native module. Each dependency is a potential source of issues, when you do your next React Native version upgrade (and you are going to do that often). As a rule of thumb avoid adding dependencies that have less than 1000 stars on Github.

6. On iOS, link React Native and third-party dependencies with CocoaPods. Any good third-party library supports CocoaPods (if not then it is a strong argument against using the library). This works better than react-native link.

7. Update React Native version to the latest release as soon as possible, unless your own product is really close to release. But make sure to give some time to the maintainers of your dependencies to catch up. React Native evolves rapidly. If you skip a bunch of updates, you might find yourself in a difficult position to catch up.

That's it. I hope following these high-level recommendations will help you to avoid a lot of problems in a long run.

Vitaliy Ivanov Technical Director at Factorial Complexity