createElement is written in native code, i.e., C++.
So this is the process that happens under the hood to create a single button on your webpage.
How does React Native works?
When you write applications in native code like Java, Swift, Kotlin for mobile apps, the app code directly access the Operating System's API to create a button. In the case of React, the bridge is something similar to a browser when creating web pages, but in the case of React Native, the bridge serializes and deserializes your line of code which is comparatively slower than the browser.
How React JS Works?
React vs React Native
When it comes to representing the UI, you can also represent the react-native UI in tree form. So when someone taps, react checks whether something needs to be changed. If so, then React Native script will say to change a particular component.
So the UI layer is pretty much the same in React and React Native as it constructs its own Component Tree. So the UI layer is the react package on the
npm. Now we need a renderer to render our component tree on the browser and the Mobile. The main difference between React and React Native is their render. React.JS uses
react-dom while react native uses
react-native as its renderer. The bridge in the mobile apps is the
react-native library itself for the most part.
On the web, we write direct HTML elements in our react code, but when it comes to mobile apps, they can't render HTML on their own, so they write in custom components made by react, which can be rendered on mobile.
So, this is the only difference when it comes to React and React Native, and for the most part, all are similar because the UI library is the same in both cases.
You can watch the YouTube video here.