What's up guys welcome back to devs on a couch, I'm Andrew. I'm Mandy. I'm Scotty
And today we're gonna talk about react native React JS and just kind of dive into the differences, similarities, and what makes them. Yeah
We're also gonna answer some common questions that we've seen people ask
So what is react native? Do you want to answer this one Mandy? Yes, okay
I think we could start with what react is. So React is a JavaScript framework that helps you write
Applications and then in contrast to that react native is pretty similar, but it is used for mobile applications
Yeah sounds right. Yeah good
Right, what is meant by native?
applications well, so yeah, so I'll go a little bit further into what you were talking about and so react native is a
mobile framework for
writing native apps in JavaScript
Typically in the past you would need to know
Either Java or Kotlin for Android or you would need to know objective-c or Swift
To write iOS apps. So what react native does is it allows you to write
Native applications. So using your native
Frameworks and being able to write directly to the device using javascript. So if you're a
web developer
Then you can write apps. You don't need to know Java and objective-c and all that stuff. Which is good news for me
I didn't know any any mobile development coming into react native only was web came from angular
Hmm got into react did reactJS and then jumped into react native
What was your first experience with react native mandy, so I started with well
Just plain JavaScript and then I learned reactJS and then switching to react native. It really wasn't that difficult
I think like the main differences were just like little syntax things like not using dibs using views instead and
capitalizing them instead of lowercase
But as far as those little tweaks having learned React helped me learn React Native
Yeah
And my first experience so I actually began as an Android--Native Android
developer and switched to iOS
Using Swift but we had a client project that we were doing two different code bases
So we had one in Swift and then one in Java. When it came to doing the rewrite, we noticed that the
Swift app and the Java app were they didn't have a hundred percent feature parity
and so what we wanted to do is explore what it would look like to have a single codebase so that the Android and the
IOS app would be exactly the same
And so it was around that time when react native it was probably about a year old at that time
It was getting to be somewhat stable-ish, you know as far as react native is stable
We ended up doing a complete rewrite of the app and it was actually overall a
Pretty good experience, and it worked on both platforms
With some minor changes here and there but yeah, it was a pretty good experience. Yeah
I think the thing that I learned about react native through working on it was that the whole time
I was developing
I was focusing mostly on iOS like always testing in that environment and then once we got to the end
I realized like I haven't been trying this in Android and then ran into some issues so had to kind of like rework things
So that would be one pointer is if you really are planning on deploying to both platforms then test in both as you're going along
Yes. Yeah, Scotty you mentioned the stability. What is ReactJS? It's version is in the late teens at this point?
I mean 17ish or almost to 17 but react native isn't to version 1 yet
so that's kind of a
That's kind of a consideration to take in when kind of jumping into it is knowing that I mean
They're not to version one yet. It's very powerful. But there may be other options, too to consider
Like what do you what do you do
if you need to jump into the actual native code and you don't want to just write in JavaScript or
Need some more functionality on top of that. So that that question there. There are some libraries that
third-party developers have created that allow you to
add features to that would require native code. You have to do what's called linking and
Basically, it's adding these native libraries to the Android app or or to the objective-c app
but that can be pretty hairy, especially if you've never done
mobile development before
The promise of react native is that you can learn once you can learn ReactJS and
You can write it on web or mobile and kind of our experiences is it's not exactly true
There's enough differences that
You have to take some some leaps here and there and if you need to work on native code, it can be a pain
Especially if you've never done native development, so you you almost if you're doing a mobile app
You you almost even with react native. You still need to kind of know what you're doing because you're
gonna have to get into
X code or you're gonna have to get into Android studio
unless
you use
Expo. The the great thing about Expo is it
Gives you a lot of the the low level hooks into
The native apps that you would normally have to use native code for so as Mandy mentioned push notifications is a big one
Mapping is another one
basically, if you go to Expo dot io, there's like a full list of all the packages they include. I always recommend if
Someone is building a react native app
Or if they're considering building a react native app to first go and look at what Expo gives you for free
Because if you can play in in that sandbox
Then your life will be way easier
You won't have to
Fiddle with a lot of the versioning issues that you get
Just with react native whenever you start to have to manage all of your code and all the upgrades and everything else
100% on your own then
It can be a little bit of a bear. Mm-hm you bring up just what the prerequisites are
You need to jump into react native. Do you think you need to learn ReactJS before you learn react Native?
I would say no not necessarily--because you didn't did you do it at the same time or did you? I did JS first
and then native
But I would say like if you know that you want to do mobile development and then just jump straight into react native
Did you find learning reactJS at least on some level helped you in native?
Yes Or was it just the JavaScript that helped you in general?
I think learning ReactJS helped me but I think it could go the opposite way if you learn Native First, that will help
You learn JS. So Scotty, what are some of the things that people are asking these days? I can read it too. Okay go
Okay, what programming experience do I need before diving into react native?
Mmm-hmm good question--Mandy? I would say to start with a good basis of JavaScript
When I was starting to learn ReactJS--well, I started learning that, and then I got some advice to learn JavaScript first--
Which I thought was helpful for me
Just that way you can differentiate between okay
This is coming from JavaScript as a whole this is coming specifically from ReactJS or react native
So either path I would say starting with JavaScript would be probably a good start
I think from a mobile side--I was telling Andrew this at lunch today actually--I thought Android development
Set me up for success for react native development
And I think it's because you get used to kind of programming in this resolution independence. You're not really tied to like a
pixel width and stuff like that
And so when it comes to flexbox and and some of the other ways of laying out your screens
It just felt very natural to me as a former
Native Android developer and current. And I think we touched on before, you don't need to
Understand ReactJS before jumping in to react native
Right. Understanding JavaScript definitely does help, but I think knowing things like flexbox since ReactJS is heavily dependent on that as well
Will definitely help you in react native, but it wouldn't necessarily be something you have to know in any way
But probably the Android or Swift development. Yeah
Will my code automatically work from reactJS in react native? The answer shortly. Yes
No
DIVS don't work in reactive
No matter how many times you write it. Facebook says that it's a learn once, write everywhere. Yeah, that's in the documentation. And it's False
Well, and they're trying to come out with react native web, which is supposed to bridge that gap, too
But yeah, it's even a lower version than React Native
So in ReactJS, it's you know, you have DIVS and stuff like that
But in react native, it's a view for one thing. You don't have DIVS
So, yeah, you couldn't you couldn't take just a ReactJS
Codebase and then just run it on
Mobile. It just wouldn't work. So it's actually a little worse than that
Because in this last project I was working on, some of the components in iOS don't even work in
Android. Yes. Which is a huge pain in the butt. And it was something simple like a
the text component in
React Native was causing Android to fail
That probably gets more back to the instability of react native than anything else. It's clearly not a 1.0
Framework right now just because there's there's so many inconsistencies
As Mandy said earlier, you you really do have to test all along the way. You can't use ReactJS code in
react native
So yeah, the promise of 'learn once write everywhere'
Structurally speaking, that's true. Like you can structure components the same way
but the actual code
No. So are there other frameworks that will allow you to write one code base across all platforms--mobile, web,
native desktop?
No, I mean there are a couple that are coming close flutter. We've already talked about in another video
It's trying to kind of bridge that gap in some ways
But is it even worth it to have all your code in one place in one?
I mean you're gonna need different things on mobile than you're gonna need in web and having it all there can just clutter everything
I feel like. Yeah, I I will say that one one cool thing and I know this isn't a flutter video but
Because of the way that flutter is engineered, I mean, it's it's essentially written like a 2d gaming engine
It's I can't remember the canvas or what it's called
But the 2d engine that it's written on top of but I think that's one of the reasons why you have that
Consistency on flutter that you don't have with react native just because react native it actually goes
Directly to the base components on both of the platforms
And so I I know we're kind of giving the developers grief on the instability
But it is it is a little bit harder their approach so kudos to Google for figuring out a better way to do it. Well, that's the thing
I mean some of the cons we've talked about
Instability, I think another con would be just something as simple as not having
Native navigation right than it. Yeah party navigation component library component libraries. I mean, there's stuff like that
What are some of the pros that you would see with the react native? I mean, I would say there's big companies using it
I mean Facebook, but obviously they love it. So they're gonna have that support and they're constantly
Upgrading things and trying to figure out this stuff. So I think the support from
big companies but also
some open source development stuff.
Yeah, and since a lot of people are using it there's a ton of like stuff out on Stack Overflow
You could find if you need answers--there's a lot
When you google it and I mean if you're taking react native compared to writing native code itself
It is way easier. I mean, I know JavaScript so I can write in React Native.
Yeah, it's definitely faster. It's it's just not a silver bullet
I don't think that react native is a great fit if you need a highly performant app, it's good
like I always say it's good for CRUD apps, which
honestly, I don't know I can make up a percentage but
93 and a point five percent of all apps are CRUD apps. Most apps are
Just connecting to a server you're reading and writing information
And so if your app is that then react native is great for that. For the most part
I mean most of the apps that we've written with it are those type of apps and
We've had great success with it and clients have been super happy
however, if you need something more performant, I know in our previous video the flutter video we talked a lot about
Animations and just that that fluid 60 frame per second UI
Then you know I would probably lean toward flutter even in our little bit of knowledge about flutter right now
Just flutter is better for that. Or if you need to write a game or something like that
Then you want to use native code. You don't you don't really want to do one of these cross-platform
tools so if you were wanting to start from scratch on a native app and not use react native or flutter or any of these
Other frameworks what languages would you be writing in for iOS, Android, Windows? on Windows Phone?
Remember Windows?
For Android most of it can be written in Java or Kotlin now, but there's like configuration in
XML so I would say that you definitely want to be familiar
With Java and XML for Android. For iOS, it's Objective C or Swift
I think that's pretty much it. The rest of it is really just becoming super familiar with Xcode
and yeah, the tool chains on an iOS project you probably need to become familiar with
Carthage or cocoa pods, I think most people are using cocoa pods. On Android,
You need to know Java and XML
But you also need to be somewhat familiar with Gradle and that whole build process
Alright, thank you guys so much for watching and we will be coming out with more content
The next video is going to be an intro to react
So be sure to subscribe below so you don't miss that and give us a thumbs up
Bye