expo/use-dom logo

expo/use-dom

Free

Run web code in a webview on native using DOM components

FreeFree tier
Type
Open Source

About expo/use-dom

use-dom is an Expo library that enables rendering arbitrary web-based code inside a webview within a React Native application. It provides native DOM components that act as bridges between React Native and web views, allowing developers to reuse existing web UI components or run web-only code (e.g., rich text editors, charts) directly in their mobile apps without rewriting. It is part of the Expo ecosystem and is commonly used for embedding complex web interactions that are otherwise difficult to implement natively.

Key Features

Renders web components inside a native webview
Provides native DOM bridge components for React Native
Allows reuse of existing web UI across platforms
Integrates with Expo's managed and bare workflows
Supports communication between React Native and web code

Pros & Cons

Pros
  • Leverages the entire web ecosystem for UI components
  • Easy integration with Expo projects
  • No need to rewrite existing web code for mobile
  • Enables complex UI interactions (e.g., canvas, D3) on mobile
Cons
  • Webview introduces performance overhead and memory usage
  • Limited to capabilities of the WebView (no native performance)
  • Requires managing communication bridge between native and web
  • Not suitable for high-performance native gestures or animations

Best For

Embed existing web content (e.g., markdown editors, charts) in mobile appsRun web-only JavaScript libraries in React NativeBuild hybrid apps that share UI components between web and mobilePrototype web features inside a native app quickly

FAQ

What is use-dom?
use-dom is an Expo library that allows you to run web code inside a webview in a React Native app using native DOM components.
Do I need Expo to use use-dom?
Yes, use-dom is part of the Expo ecosystem and is designed to work with Expo managed and bare workflows.
Can I use any web library with use-dom?
Generally yes, as long as the library runs in a browser environment. You can embed libraries like custom editors, charts, or maps.