Picture a scenario where you write an app just once, and it seamlessly runs across various platforms. That’s the ambitious goal of React Strict DOM (RSD, react-strict-dom). In the React ecosystem, we grapple with React DOM for web applications and React Native for native platforms (including React Native for iOS, Android, MacOS, Windows, TVOs, VisionOs, and Skia). This division often translates to extra effort and occasional headaches. Enter RSD—a tool designed to simplify the process, allowing us to build apps without fretting about the specific platform.
What Exactly is React Strict DOM?
React Strict DOM (RSD) adopts a contrasting strategy compared to React Native for Web. Instead of relying on a separate implementation, RSD leverages Web APIs directly to render components. To achieve this, it introduces two lightweight polyfills that serve as intermediaries, translating its APIs into both React Native and React DOM primitives.
Furthermore, RSD integrates closely with StyleX, a CSS-in-JS library from Meta, to provide a unified styling solution that works across platforms. This integration allows developers to style their applications using a familiar CSS-like syntax while benefiting from the performance and safety features of StyleX.
In the React ecosystem, react-strict-dom represents a significant leap forward. It appears to be the natural successor to React Native Web, promising the ability to construct universal apps from a single codebase. These apps can seamlessly target multiple platforms, leveraging each platform’s APIs without any trade-offs or performance concerns.