There is something I found pretty
interesting lately in React Native and I want to share it with you today :) One thing we can probably all agree about is
how React Native has helped us to break many walls over time. It's simple, cross-platform and
keeps evolving. Although it has started as a way to reuse React knowledge on mobile, it was only a
matter of time before the community tried to make it work for desktop as well. In late 2015, almost
6 years ago, Dima Loktev started react-native-desktop which was later renamed to -macos and
turned out to be only focused on Apple computers. So at that point, it was very unclear if we could
ever use React Native on Windows for example. But that was until a year ago, after Microsoft
released a new version of react-native-windows, more stable and complete. The great thing about
it is having a big company using React Native for some of their projects is immensely helpful to
keep things moving quickly. Not only it would work for Windows, but also macOS, Xbox and others. So this
was a year ago and to be honest, things weren't as pretty back then since this was still something
taken out of the lab. But a few days ago, I thought it was time to give it another try...and for this,
we'll need this other laptop. I think we should start with a few things. First, not everything from
React Native works on the Windows version. Although there's a lot of it already added, you can still
find yourself stuck with some missing APIs and the same goes for popular community libraries that
might not have their version yet. So just so you know, you can't expect everything to work as with
mobile. That being said, there's still a bunch of libraries you can choose from since a lot can be
done with pure JavaScript in general. If you need navigation, react-navigation works pretty well out
of the box but also camera, pickers, etc. for native. All you need is to import them yourself as
you usually do with a bare React Native app. So basically you can make simple React Native
applications running on Windows. This, is one I've done that can give you an idea of what you can do
without too much configuration. I just made a chat box that shows fake conversations so I could
play with scrollviews, big lists of elements, vector icons or even images and text inputs. Now
I'll be honest with you, at the very beginning I was quite worried. My app wouldn't build, it was
the first time I was launching Visual Studio (not VS Code) to make an app for Windows. Another thing is that it
usually takes a very long time to compile, at least on my computer... ._. We're talking maybe 5 to 10
minutes each time you're making a native change, but this is quite similar anytime you're not using
Expo. Sometimes though, it was quite frustrating to wait till the build finished to realize that
something wasn't working. But to be honest, this was either coming from my lack of knowledge
or sometimes, and that one's not too good, from the package documentation. I won't give names here but
after following the instructions for a project, looking at issues, it took me a full hour to
realize that it would just not work on Windows. Anyways, it didn't start very well for me but after
this, everything worked fine! :) The only step that's important for newcomers like me is to install
native libraries. Every time you add one, you'll start by closing the app, installing the library
and then import it into your project. This is the part where you link the library to your app just
so during the build process it knows where to look for the dependency. Once it's done, you build
and run the whole thing again and that's it. It's just a matter of learning it once and then
you're good to go. Now obviously I wasn't working with something too complex at this point so
you might be thinking "this doesn't mean much". However, if you have Messenger on desktop,
they're actually using react-native-windows for their app and when I see the final result,
there's no way I would ever think this had been done with React Native and this proves you what
you can get with more time and energy. It's also been known that Xbox used it for their PC app
and the result is as impressive as Messenger. Personally, I didn't think it was possible
to make such apps using React Native. People working on this project have done a really
good job although it still needs to mature before it gets as simple as making a mobile app. You
know actually, before giving it a try I didn't even think this was an alternative. I mean today,
everyone is using Electron if they want to reuse their React code on desktop and that's usually it.
So in that sense, it is definitely a step forward. Now I wouldn't say react-native-windows is a
good fit for everyone: you still need to check the available native libraries before you get started
because some of them are quite old or non-existent. But if you have Windows running somewhere, you
should seriously give this a try because you might not need Electron next time. If you're curious
about the small app I made, you can find a link down below but truth be told, it is just React
Native code. Alright, that's it for today, Let me know what's your opinion in the comments, I'd be
really happy to see what you guys think. Remember to subscribe if you want
more React Native videos, Thanks for watching and see you next time :)