In React, the Virtual DOM acts as a layer between the developer’s description of how
things need to look and therefore the work done to truly render your application onto the
To render interactive user interfaces during a browser, developers must edit the
browser’s DOM, or Document Object Model. This is an expensive step, and excessive
writes to the DOM have a big impact on performance.
Rather than directly render changes on the page, React computes the required changes in-memory and re-renders the minimal amount necessary.
how this works.
In the context of React on the online , most developers consider the Virtual DOM as a
The Virtual DOM certainly has performance benefits, but its real potential lies in the power of its abstraction. Placing a clean abstraction layer between the developer’s code and therefore the actual rendering exposes tons of interesting possibilities.
What if React could render to a target aside from the browser’s DOM? After all, React already “understands” what your application is meant to seem like.
Indeed, this is often how React Native works, Instead of rendering to the browser’s DOM, React Native invokes Objective-C APIs to render to iOS components, or Java APIs to render to Android components.
This sets React Native apart from other cross-platform app development options, which frequently find yourself rendering web-based views
This is all possible because of the bridge, which provides React with an interface into
the host platform’s native UI elements.
React components return markup from their render function, which describes how they should look. With React for the web, this translates directly to the browser’s DOM. For React Native, this markup is translated to suit the host platform, so a might become an iOS-specific UIView.
The core React Native project supports iOS and Android. Because of the abstraction
layer provided by the Virtual DOM, React Native can target other platforms, too—
someone just needs to write the bridge.
For example, there are community implementations of React Native for Windows and Ubuntu, so you can also use React Native to create desktop applications.
If you like this post, don’t forget to share 🙂