use-dom

Run web-only React components in Expo apps via webview.

13|1|Updated Oct 13, 2023
One-click install
npx skills add https://github.com/luke-h1/foam --skill use-dom-luke-h1
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: use-dom
Source: https://github.com/luke-h1/foam/tree/main/.agents/skills/use-dom
Command: npx skills add https://github.com/luke-h1/foam --skill use-dom-luke-h1

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill allows developers to seamlessly integrate web-only libraries and existing React web code into their Expo mobile applications, enabling incremental migration and leveraging the vast web ecosystem on native platforms.

Core Features & Use Cases

  • Web-Only Libraries: Use libraries like recharts, react-syntax-highlighter, or any DOM-dependent React web library directly within your Expo app.
  • Incremental Migration: Bring existing React web components to native without a complete rewrite.
  • Complex Layouts: Implement intricate HTML/CSS layouts that are difficult or impossible with standard React Native components.
  • Use Case: Embed a complex charting library (like Recharts) or a rich text editor into your mobile app, which would otherwise require significant native development.

Quick Start

Create a new file with the 'use dom'; directive at the top to define a DOM component.

Frequently Asked Questions about use-dom

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use web-only React components in an Expo mobile application?

To use web-only React components in Expo mobile applications, you can bridge web and native environments using a webview on native platforms. This enables the direct integration of DOM-dependent libraries like charting tools directly within your app.

Can I migrate an existing React web codebase to React Native incrementally?

You can migrate an existing React web codebase to React Native incrementally by running web code within a native webview context. This approach allows you to bring existing React components to native platforms without requiring a complete rewrite.

What is the best way to render complex HTML and CSS layouts in React Native?

The best way to render complex HTML and CSS layouts in React Native is to use a DOM bridge that runs web code inside a native webview. This allows you to implement intricate HTML and CSS layouts that are difficult or impossible with standard React Native components.

Does Expo DOM support passing props and native actions to a webview context?

Expo DOM does support passing props and native actions to a webview context by allowing you to pass serializable props to the webview. It also enables exposing native actions directly to the webview context for bidirectional communication.

How do I get started with the use dom directive in Expo?

To get started with the use dom directive in Expo, create a new file and add the 'use dom'; directive at the top to define a DOM component. This establishes the webview boundary required to render web-only libraries within your mobile application.

When should I avoid using a webview for web components in React Native?

You should avoid using a webview for web components in React Native when dealing with non-serializable data, as this approach specifically supports passing only serializable props. Additionally, performance-critical UI elements may not be ideal for webview rendering.