Cordova.
The idea of writing the same code for two mobile platforms appeared almost as soon as the two platforms appeared. One of the first, oddly enough, was a JS framework called Cordova (originally called PhoneGap). Its first release was in 2009.
It is a browser (Web View) wrapped in a mobile application icon.
You can develop on anything in front-end development and refresh the page during development via F5 or set up a full-fledged project in React, Vue, or Angular.
It’s a fairly low-level framework, a set of libraries for working with mobile platform APIs and linking them to WebView.
Over time, Cordova grew to include various templates and assemblies based on different web technologies, but the big problem was the look, no one wanted to see just a website on a smartphone, they wanted something similar to a native application.
Ionic
The solution to this problem was Ionic, which was based on Cordova and had its own library of UI components that made it possible to make the application look like a native one.
Initially, the framework allowed development only in Angular, but in version 4, they added support for React and Vue, and switched from Cordova to Capacitor, a project that allowed any web application to be wrapped in WebView in a minimum number of steps using PWA (Progressive Web App) technology.
It turned out to be a good solution to sketch a prototype on what you know (or your team knows) to quickly assess its relevance.
Although some serious applications run on Ionic and perform well in terms of speed and resource requirements.
NativeScript
But WebView is not the only approach that can be used to push our JS to mobile devices.
A framework called NativeScript has done it in a rather interesting way. The API is woken up by reflection, and the JS side works with it.
In practice, it looks like you write, for example, in Java, but through a JS wrapper.
React Native
As you may have noticed, NativeScript doesn’t support React. So, as expected, React Native appeared as a result of the hackathon. The goal of the developers was to show that React can be used for any virtual DOM tree rendering engine, even if it is a mobile platform.
The first release took place in 2015. And it was React that became the basis for the framework’s popularity. Now it is a cross-platform JS standard that is often used for Enterprise solutions.
Under the hood, this framework is very similar to NativeScript, but with a better API abstraction, where native plugins are written on the platform side (and can be extended by the application developers themselves), and only parameters are passed from JS to them via a bridge. Rendering is handled by the cross-platform framework Yoga, which implements the flexbox layout on the target platform.
What should a beginner choose? In general, I don’t think cross-platform is a good choice for a beginner in JS. But if you are still interested in trying to write for smartphones, choose React Native, at least you will have community support and thousands of questions and answers on Stack Overflow.