Five React Native gotchas you need to know about.

Why I wrote and why you need to know this.

Feargal Walsh
codeburst

--

You may be playing around with the idea of react native and let me say first of all in case you don’t read until the end that I would highly recommend it. The learning curve could be high if you are not familiar with JavaScript like I was, but I’ve been working with it for about nine months and I’m comfortable enough now to be writing regularly about it so it mustn’t be so bad. However, there are some major gotchas that I want to save people from.

1. Redux will make things easier, learn it.

You can’t swing a cat these days in the React world without hearing about redux. Redux is:

“A predictable JavaScript state container to keep your state in one place”

Managing state is one of the most unwieldy and challenging branches of programming. It is also incredibly important. Redux is built on top of the Flux architecture and is much easier to manage than the out-of-the-box implementation.

My favourite Redux Diagram

This is a great analogy to get your head around the why of Redux.

2. React-native-maps is really hard to get working.

Just follow this, and be cognizant that some of it may be slightly out of date but Kirsten Swanson has done an excellent job of keeping it current. Forget about Github, a lot of the issues on this library are rabbit holes.

3. Don’t use Typescript if you’ve already gotten into the habit of a particular build process.

If you’re like me and pretty much any human alive, you’re a creature of habit. And once we get used to getting something working a certain way, and more importantly in a certain time, the reduction or complication of that process by the smallest possible amount becomes unbearable. After all, two out of the three most important qualities of a programmer are laziness and impatience. If you try and integrate TypeScript into an already started project you will need to transpile all of your code into a build folder every time you make a change, so you can kiss goodbye to our beloved live and hot reloading.

UPDATE:I was wrong about this, thanks to orta for correcting me. Its not that hard to incorporate your current build process into a transpiled TypeScript build file these days.This issue goes into more detail on how to set it up.

4. The iOS release to the App store process even more complicated than normal.

You can avoid XCode for pretty much everything in React, aside from the odd issue regarding Libraries and CocoaPods being duplicated. However, when you do need to upload to Testflight or the Appstore, or even run on a device, there are a few extra steps you need to follow which can get hairy.

5. Use SSH with Fastlane

A recent issue that I ran into on my current project, Zonder is that if you are using Fastlane Match and Bitbucket with an HTTPS URL, your URL will change depending on which user is logged in to Bitbucket. Match requires you to hard code the URL where the signing certificates are stored. I don’t believe this would be an issue with Github. However, if you switch to SSH you will have one common URL for anybody using your project, and the SSH key is the variable that will change. This is a good idea to keep your certificates secure regardless of which version control system you use.

Thanks for your attention, it’s the most valuable thing you can give anyone. The hardest thing about writing these posts is often getting started, so any suggestions/requests for topics would be appreciated! I also welcome feedback on previous posts.

https://www.youtube.com/watch?v=DdCYMvaUcrA

Resources

http://almerosteyn.com/2016/08/redux-explained-again

✉️ Subscribe to CodeBurst’s once-weekly Email Blast, 🐦 Follow CodeBurst on Twitter, view 🗺️ The 2018 Web Developer Roadmap, and 🕸️ Learn Full Stack Web Development.

--

--