@dpage-ai/react-native-dpage

react-native-dpage

Dynamic component system with caching for React Native. Load server-driven UI components at runtime without app store updates.

Quick Start

Get your first dynamic component running in under a minute with just a few lines of code.

App.tsx
import { initDPage, initLifecycleListener, DynamicComponent } from '@dpage-ai/react-native-dpage';

// 1. Initialize once at app startup
initDPage({
  projectId: 'my-project',
  apiToken: 'dpage_live_xxx',
});

// 2. Enable auto-save on app background (for persistent state)
initLifecycleListener();

// 3. Render dynamic components anywhere
<DynamicComponent name="MyComponent" />

Features

πŸ”„

Server-driven UI

Load UI components from your server at runtime without app updates

πŸ’Ύ

Smart Caching

Multi-layer caching with AsyncStorage for offline-first experiences

⚑

Preloading

Preload components at app startup for instant display when needed

πŸ“Š

Events & Monitoring

Built-in event system for observability, analytics, and debugging

πŸ”’

Type Safety

Full TypeScript support with type-safe component props

πŸ›‘οΈ

Error Boundaries

Graceful error handling with customizable fallback components

πŸ’Ύ

Persistent State

Save miniapp state locally with optional cloud sync hooks

How It Works

The dynamic component system uses a multi-layer caching strategy for optimal performance:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Request Component β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ In Memory? │──Yes──► Return (instant) β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ No β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ In Cache? │──Yes──► Load & Return (~10ms) β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ No β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Fetch from API │──Yes──► Cache & Return (~200ms) β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ Failed β–Ό β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Use Fallback │────────► Return (graceful) β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Performance

ScenarioLatencySource
First load~200msNetwork fetch + cache
Cached (warm)~10msAsyncStorage cache
Memory (hot)<1msIn-memory cache

Next Steps