While the names imply that they’re very similar, React (or ReactJS) and React Native are quite different beasts.
Before you decide which is most suitable for your project, or which would be best to focus on as a developer, it’s worth getting to grips with the basics of each, how they work and what they’re for.
React and React Native: Background
Meta developed React as a component library for JavaScript, enabling faster development for creating user interfaces (UIs) for web applications.
They then developed React Native to essentially do the same for native apps, using the React framework as a base.
Both frameworks have become really popular with agencies and development teams, who can speed up and streamline coding, making projects faster and less complex.
What is ReactJS?
React, or ReactJS is a JavaScript library, which is used to create UIs.
It’s based on reusable components, so that instead of having to individually code each aspect of an element, you can create a single, reusable element that can then be customised through establishing different properties, such as colour.
This can drastically reduce coding time and simplify the build process.
The virtual DOM similarly speeds up development by removing the need to re-load the entire DOM each time changes are made. Instead, the virtual DOM is compared to the real DOM, and only differing elements are updated.
ReactJS is designed for use in-browser, so it’s a great option for creating web applications, and websites - particularly if you’re implementing a headless CMS.
What is React Native?
React Native is a framework which operates along the same lines as ReactJS - using components rather than individually coding everything.
However, while React is designed to operate in-browser, React Native is designed to create UIs for native apps in both iOS and Android.
The React Native framework is what enables developers to create native apps from a single codebase, which can then be utilised by both platforms, rather than having to create unique codebases for Android and iOS.
React vs React Native: Which is right for my project?
The different applications for ReactJS and React Native mean that it’s the type of project you’re working on that should determine which is right for you.
ReactJS is for creating web apps, PWAs, SaaS and websites - anything that runs in-browser.
React Native is for creating native apps - those that can only be accessed by downloading the app onto your phone.
However, with some projects it can be difficult to work out what sort of setup will be right for you.
How do I know if I need a native app or PWA?
There are a number of different ways for you to work out whether a mobile app or a progressive web app would be the right choice for you.
But two of the key differences are based around functionality, and updates.
PWA
A progressive web app is something that works in a browser, like a website, but has native app-like features and functions.
For most mobile users, it will feel like they’re using an app, and they will be able to get things like push notifications and screen shortcuts.
Because it uses the same base code as your website, it makes updates much easier. So if you’re working on a project that’s likely to change over time - particularly if you’re starting with an MVP - a PWA could be a great option.
Native or mobile app
A native app, or mobile app is something that has to be downloaded from the Apple or Play store, and is more like a program that you access via your phone.
That means it can access more of your phone’s features, such as the camera, and often provides a faster user experience as it may not need to rely on an internet connection after it’s been downloaded.
Mobile apps are, however, a bit more complex to keep up to date, as new versions must be downloaded by each user individually. This can be complex if you’re making lots of changes to your project, and can leave you with disgruntled users still on legacy versions.
But with a wider range of functions and features, a native app can be the ideal choice for more complex projects.
What’s the difference between React Native and ReactJS?
While there is a lot of crossover between the two, there are also distinct differences that a developer needs to be familiar with in order to be able to use each framework.
But for a project, the difference between React and React Native is really in its application (literally!).
So if you are creating an app for iOS and Android - React Native is the right choice for you.
If you’re creating an app or website that will be accessed in-browser, then ReactJS is your best option.
And if you need a development team to help with either, Edge of the Web have the experience to help you make the right choice for your project.