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.
- 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.
- 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.
- 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.
- Limit the usage of third-party libraries. Think twice before you add something to
dependenciessection of your
package.jsonfile. 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.
- 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
- Update React Native version to the latest release as soon as possible, unless you are really close to release. But make sure to give some time to the maintainers of your dependencies to catch up. React Native evolves rapdily. 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.
Originally published at www.factorialcomplexity.com on August 21, 2018.