🇬🇧 English · 🇹🇷 Türkçe · 🇪🇸 Español · 🇩🇪 Deutsch · 🇫🇷 Français · 🇯🇵 日本語 · 🇨🇳 中文 · 🇮🇹 Italiano · 🇧🇷 Português · 🇮🇳 हिंदी
A Vite shell with two React 18 apps on two routes. Nav links switch apps without a page load, and the home app receives props from the shell.
| Package | Role |
|---|---|
@tuvix.js/core |
Shell orchestrator, router config, interceptLinks |
@tuvix.js/react |
createReactMicroApp |
npx create-tuvix-app@latest --example with-react my-app
cd my-app
npm install
npm run devgit clone https://github.com/yasinatesim/tuvix.js.git
cd tuvix.js/examples/with-react
pnpm install
pnpm devOpen http://localhost:5173. The shell redirects / to /home.
with-react/
├── index.html
└── src/
├── shell.ts ← routes, app registration, interceptLinks
└── apps/
├── home/ ← receives { theme, user } from the shell
└── about/
createReactMicroApp({ name, App })returns a module withmount,updateandunmount, and registers it undername. Each container gets its own React root.- Props: the shell passes
{ theme: 'dark', user: 'Alice' };HomeAppreceives them as ordinary React props. - Routing:
{ path: '/home/*', app: 'home' }mountshomeon/homeand below and unmounts it when you leave. - Entries:
entry: () => import('./apps/home/main')lets Vite split each app into its own chunk. An app deployed on its own would use a URL instead, such asentry: 'https://cdn.example.com/home/main.js'.