use-dom
Run web-only libraries in Expo apps by rendering them in webviews on native and as-is on web.
- Supports any React web library (recharts, react-syntax-highlighter, canvas, WebGL) without modification by wrapping it in a DOM component file with the
'use dom';directive - Passes serializable props and async functions from native to webview, enabling bidirectional communication between native and web contexts
- Includes webview configuration options via the
domprop: scroll control, safe area behavior, manual sizing, and style overrides - Works with Expo Router navigation APIs; router state hooks require passing values as props from native parent components
- Renders in WKWebView on iOS, WebView on Android, and as standard React on web with identical code
What are DOM Components?
DOM components allow web code to run verbatim in a webview on native platforms while rendering as-is on web. This enables using web-only libraries like recharts, react-syntax-highlighter, or any React web library in your Expo app without modification.
When to Use DOM Components
Use DOM components when you need:
- Web-only libraries — Charts (recharts, chart.js), syntax highlighters, rich text editors, or any library that depends on DOM APIs
- Migrating web code — Bring existing React web components to native without rewriting
- Complex HTML/CSS layouts — When CSS features aren't available in React Native
- iframes or embeds — Embedding external content that requires a browser context
- Canvas or WebGL — Web graphics APIs not available natively
When NOT to Use DOM Components
Avoid DOM components when:
- Native performance is critical — Webviews add overhead
More from expo/skills
building-native-ui
Complete guide for building beautiful apps with Expo Router. Covers fundamentals, styling, components, navigation, animations, patterns, and native tabs.
39.1Knative-data-fetching
Use when implementing or debugging ANY network request, API call, or data fetching. Covers fetch API, React Query, SWR, error handling, caching, offline support, and Expo Router data loaders (`useLoaderData`).
30.9Kexpo-tailwind-setup
Set up Tailwind CSS v4 in Expo with react-native-css and NativeWind v5 for universal styling
27.2Kupgrading-expo
Guidelines for upgrading Expo SDK versions and fixing dependency issues
26.9Kexpo-cicd-workflows
Helps understand and write EAS workflow YAML files for Expo projects. Use this skill when the user asks about CI/CD or workflows in an Expo or EAS context, mentions .eas/workflows/, or wants help with EAS build pipelines or deployment automation.
25.7Kexpo-deployment
Deploying Expo apps to iOS App Store, Android Play Store, web hosting, and API routes
25.2K