Tech reviews are a dime a dozen — Googling, you’ll find tons of documentation about Xamarin and React-Native, tons of samples you can follow, plus tons of concerns that get aired and then answered by the various communities out there.
This article is different because I’m not going to talk about pros and cons (you already have a lot to read out there). Instead, this is about my experience learning React-Native from scratch. I’ll talk about the parts I really struggled with, the easy parts and then I’ll wrap it up with some conclusions and tips on how I got through this transition without dying in the attempt.
First of all: why even make this transition at all?
The whole experience of transitioning to React-Native has taught me one thing: there’s no such thing as the “best” platform/technology that covers all kinds of project needs. Each has its pros and cons.
Therefore, this migration is not motivated by the idea that one platform is better than the other. It’s more about adaptation and experience.
Everyone knows that global trends change all the time. These trends serve to show us which platform/technology is working well in current global situations. And then maybe you have a new situation that didn’t exist before. Here’s where some platforms begin to grow and gain strength over others.
There’s a huge difference between technologies that adapt themselves and persist and those which don’t adapt to new global situations. The latter are the types that slowly start to disappear.
Evolve to survive, right? Technologies that don’t understand this will disappear in time (thank you, Mr. Darwin) ;). Likewise for developers, who are part of an ecosystem of constant change. They must be able to adapt, too.
Let’s put this into context:
These days, people are connected across many platforms. Xamarin and React-Native are both answers to a particular global need: cross-platform development.
As a mobile developer, you can see the value in both options, right? So why would you want to learn both? The answer is, you don’t have to. If you’re a Xamarin developer you won’t feel duty-bound to learn React-Native and vice versa.
But let’s look at the matter in light of our explanation of adaptation. As a developer, knowing both technologies could open up your point of view and expand your resources for creating cross-platform applications. In addition, we don’t always have the last word when it comes to making big decisions on a project. I’m talking about the resources of the company, the project requirements, the proposed design, or maybe even the client desires… there are many variants that will affect the outcome when you’re asking that all-important question:
Which platform should we use to make a cross-platform application?
If you know both, you will be on the path to becoming a good mobile developer. And more importantly overall: you will be in a better position to contribute to your company’s success in the area of mobile.
Every developer has their own preferences about what platform they prefer to use. Usually, it’s the one we know the best. This is, of course, because it allows us to work faster and we feel more confident with what we do. And quite possibly — and this is the hardest part to overcome — we never have to leave our comfort zone if we stick with what we know.
The thing is: all those nice feelings go away when you start learning a new technology. You feel like a beginner all over again (and you are!). This can easily bring a lot of people down. Productivity eventually suffers and that’s not something we’re used to (and neither are our colleagues).
But remember to keep an eye on the big picture. When you learn a new cross-platform technology, you’re not just learning that platform: you’re gaining a better and deeper knowledge of mobile development itself. And whereas you used to just theorize and speculate about a new platform, now you’ll really have something concrete to say about it. In other words, now you can add experience to theory.
How to learn a new platform from scratch
All this might sound intimidating but the good news is that you are not trying to learn a new paradigm from scratch. You are merely learning a new platform. Luckily, there are some shared concepts between Xamarin and React-Native. These include:
- How to work async calls
- Trying to keep views as simple as possible
- Separating views from logic
- Libraries that work well in both platforms
- E.g. Redux in React and Reducto in .Net
My personal stumbling blocks were syntax, architectural pattern, and information overload. Here are my thoughts on dealing with each of them:
My many years of working with strongly-typed languages like C#, with MVVM or MVC patterns, did a number on me and caused a certain “blindness” to syntax errors.
Creating functions that don’t belong to any type in particular, the structure of a component class for example, or leave the left curly brace at the end of a line! (god sake). I spent some valious time trying to fix errors that were caused by syntax, and because my eyes are used to .Net, I didn’t see them.
There are tons of plugins, libraries, js docs… so many that if you try to cover them all, you just start running around in circles screaming that we are all going to die. So first of all, calm down. Take it easy and play some Bob Marley songs. There you go…
So, how to make decisions and focus on a course of action when you have information overload?
As you know, real mobile applications are developed in lots of different ways. What’s the best way, they one that you should learn? I would say here that you should follow what the company you are working with follows. I mean, if there is a specific need in React-native with typescript (which is easier to learn for those who come from hard-typed languages), then you should start learning typescript. If there is a specific need for Reactive programming, then you should start learning RxJs.
Knowing what course your company is taking or is going to take, will help you be productive right from the get-go.
If you are independent, you should check the trends on scalability and maintenance at the moment and go in that direction. Talking with senior colleges about trending topics could turn out to be very, very helpful.
Architectural design pattern: Flux
Flux is one of the most common architectural design patterns right now. It was designed by Facebook to resolve some pattern concerns on web applications.
As I said before, I won’t talk about their differences or which one is better because this article does not focus on technical details. I just want to describe my experience.
I used to use MVC or MVVM so Flux felt a little uncomfortable at first. I mean, I did some online courses that explain Redux with Redux-observable, and I understood lots of things (thanks Udemy and Pluralsight) but there are some topics that none of them cover, mainly having to do with best practices and performance stuff. And, as we all know, both are extremely important in real projects!
With every online course you take, you do a simple project that covers basic concepts. However, these concepts only get covered very superficially. But that is OK because they are courses, and courses do that…right? They exist to introduce you to something… but in the end, you have to walk on your own. And that is the hardest part.
I completed projects that required an understanding of most of the common topics like consume and API, add, update, rendering, making unit tests. But I got lost when I saw a real project.
I kept wondering, How can I get lost if I completed the course? Everything runs on rails and I understand what I did, so why am I getting lost now?
Again… be patient. Flux pattern has its charms but it has certain ways it needs to be implemented and each way has its tricks.
Everyone needs a guide when it comes to learning new things. Having your “Gandalf” will help you to leverage the new knowledge you are gaining and will also decrease the time you lose on errors or concerns. Your Gandalf can also help you determine the scope of whatever you are trying to do. This is crucial if you want to reach the goals you set.
Lastly, let me say that maybe there are some developers out there who want to migrate from somewhere to React-native. I hope reading about my experience helps you to take the first step!