Skip to content
Pyreon Compat
tools · migration

Keep your React code. Move to Pyreon one screen at a time.

Compatibility layers for React, Preact, Vue, Solid and Svelte cover each framework's public API with near-full parity, so your components run on Pyreon's engine. Then pyreon check and a codemod help you rewrite each screen in native Pyreon, where a component runs once.

bun add @pyreon/react-compat @pyreon/vite-plugin
Documentation
layers
React · Preact · Vue · Solid · Svelte
first step
pyreon({ compat: 'react' })imports from react stay as they are
React surface
41 exportsuse, useActionState, useOptimistic included
guides
6React, Vue, Solid, Svelte, Angular, React Native
A React component before, the Pyreon component after Top: a React Counter that runs unchanged on @pyreon/react-compat: useState, a derived const, setCount in the click handler. Bottom: the same component converted to Pyreon: signal(0), computed(() => count() * 2), count.update in the handler, props.step instead of a destructured prop, and {count()} in the markup. Each changed line pair lights up in turn. @PYREON/REACT-COMPAT · THEN ONE COMPONENT AT A TIME React · runs as-is on react-compatexport function Counter({ step }: { step: number }) { const [count, setCount] = useState(0) const doubled = count * 2 <button onClick={() => setCount(count + step)}> {count} / {doubled} Pyreon · after conversionexport function Counter(props: { step: number }) { const count = signal(0) const doubled = computed(() => count() * 2) <button onClick={() => count.update((c) => c + props.step)}> {count()} / {doubled()} abridged · when the last component moves, switch compat off
  • 41 React exports in @pyreon/react-compat, React 19 hooks included, plus createRoot and render in /dompackages/tools/react-compat/src/index.ts, dom.ts (counted)
  • 5 compat example apps driven in real Chromium by their own end-to-end suitese2e-configs/compat-layers.config.ts, e2e/*-compat.spec.ts
  • 6 migration guides: React, Vue, Solid, Svelte, Angular, and React Native for the experimental iOS and Android targetsdocs/src/content/docs/migrating-from-*.md

synthetic · author-run · M3 Max · record of 2026-11-05

Every result, including where we lose →
why teams pick it

No big-bang rewrite.

  1. Your imports stay

    pyreon({ compat: 'react' }) points react, react-dom, react-dom/client and the JSX runtime at @pyreon/react-compat. The repo's own React example imports from 'react' in 15 files and runs on Pyreon.

  2. React's rules, kept

    useState returns the value, the component body re-runs on change, deps arrays are honoured and closures go stale exactly as they do in React. Code written for that model keeps its meaning.

  3. Pyreon inside, React outside

    Pyreon's router, query, form, toast and i18n providers ship with the nativeCompat marker, so they work inside a compat tree. Mark your own Pyreon helpers the same way and React code can read their context.

  4. A checklist for the rewrite

    pyreon check src/ lists the React patterns it finds, each with its line and the Pyreon replacement (“Read: count(), Write: count.set(x)”), and exits non-zero. Burn the list down screen by screen.

the difference

Same search box. One re-renders on every keystroke.

React · runs unchanged on react-compat

Every keystroke re-runs the whole body; useMemo and its deps array keep the filter from running more than it must. Typechecked and mounted on @pyreon/react-compat as written.

import { useState, useMemo } from 'react'

export function Search(props: { items: string[] }) {
  const [query, setQuery] = useState('')
  const matches = useMemo(
    () => props.items.filter((item) => item.includes(query)),
    [props.items, query],
  )

  return (
    <div className="search">
      <input value={query} onChange={(e) => setQuery(e.currentTarget.value)} />
      <p>{matches.length} matches</p>
      <ul>
        {matches.map((item) => (
          <li key={item}>{item}</li>
        ))}
      </ul>
    </div>
  )
}
native Pyreon

The body runs once. query is a signal and matches a computed, so a keystroke updates the count and the list, and nothing else. No deps array to keep in sync.

import { For } from '@pyreon/core'
import { computed, signal } from '@pyreon/reactivity'

export function Search(props: { items: string[] }) {
  const query = signal('')
  const matches = computed(() =>
    props.items.filter((item) => item.includes(query())),
  )

  return (
    <div class="search">
      <input value={query()} onInput={(e) => query.set(e.currentTarget.value)} />
      <p>{matches().length} matches</p>
      <ul>
        <For each={matches()} by={(item) => item}>
          {(item) => <li>{item}</li>}
        </For>
      </ul>
    </div>
  )
}
the layers

Five frameworks, one engine.

@pyreon/react-compat
React

41 exports: hooks including use, useActionState and useOptimistic, plus Suspense, lazy, memo, portals; createRoot from /dom. Class components are stubs.

@pyreon/preact-compat
Preact

The root, /hooks and /signals entry points. Class components get componentDidMount, componentDidUpdate and componentWillUnmount.

@pyreon/vue-compat
Vue

The Composition API: ref, reactive, computed, watch, lifecycle, provide/inject, Teleport, KeepAlive, Transition. No .vue compiler.

@pyreon/solid-compat
Solid

Signals, stores, resources and For, Show, Switch, Index, Dynamic. Updates are per component, not per node.

@pyreon/svelte-compat
Svelte

svelte/store, onMount, onDestroy, tick, context and createEventDispatcher. Not a .svelte compiler.

@pyreon/cli · pyreon check
The checklist

Lists the React patterns left in each file, with the line and the Pyreon replacement. Exits non-zero, so it gates CI.

@pyreon/mcp · migrate_react
First-pass codemod

Rewrites React imports, hook declarations and JSX attributes. Setter calls and reads of the old state you finish by hand; TypeScript flags the dangling setters.

pyreon.dev/docs
Guides

Step by step from React, Vue, Solid, Svelte and Angular, and from React Native to the experimental iOS and Android targets.

coming from

Coming from React, Vue, Solid, Svelte stores or Preact signals?

useState and useEffect

React
import { useEffect, useState } from 'react'

export function Counter() {
  const [count, setCount] = useState(0)
  useEffect(() => {
    document.title = `Clicked ${count} times`
  }, [count])
  return (
    <button onClick={() => setCount((c) => c + 1)}>
      Clicked {count} times
    </button>
  )
}
Pyreon

No deps array: the effect re-runs when count changes because it reads count().

import { effect, signal } from '@pyreon/reactivity'

export function Counter() {
  const count = signal(0)
  effect(() => {
    document.title = `Clicked ${count()} times`
  })
  return (
    <button onClick={() => count.update((c) => c + 1)}>
      Clicked {count()} times
    </button>
  )
}

ref, computed, watch

Vue
import { computed, ref, watch } from 'vue'

const count = ref(0)
const double = computed(() => count.value * 2)
watch(count, (next, prev) => console.log(prev, '→', next, 'double', double.value))
count.value++
Pyreon

A signal is read by calling it, not through .value. watch takes the signal itself as its source.

import { computed, signal, watch } from '@pyreon/reactivity'

const count = signal(0)
const double = computed(() => count() * 2)
watch(count, (next, prev) => console.log(prev, '→', next, 'double', double()))
count.update((n) => n + 1)

createSignal and Show

Solid
import { createEffect, createSignal, Show } from 'solid-js'

export function Toggle() {
  const [open, setOpen] = createSignal(false)
  createEffect(() => console.log('open:', open()))
  return (
    <>
      <button onClick={() => setOpen(!open())}>Toggle</button>
      <Show when={open()}>
        <p>Hello</p>
      </Show>
    </>
  )
}
Pyreon

Closest of the five. Pass <Show> the signal (or an accessor) so the condition stays reactive.

import { Show } from '@pyreon/core'
import { effect, signal } from '@pyreon/reactivity'

export function Toggle() {
  const open = signal(false)
  effect(() => console.log('open:', open()))
  return (
    <>
      <button onClick={() => open.update((v) => !v)}>Toggle</button>
      <Show when={open()}>
        <p>Hello</p>
      </Show>
    </>
  )
}

writable, derived, subscribe

Svelte stores
import { derived, writable } from 'svelte/store'

const count = writable(0)
const double = derived(count, ($count) => $count * 2)
const stop = double.subscribe((value) => console.log(value))
count.update((n) => n + 1)
stop()
Pyreon

effect replaces the manual subscribe, and dispose() replaces the unsubscribe.

import { computed, effect, signal } from '@pyreon/reactivity'

const count = signal(0)
const double = computed(() => count() * 2)
const logger = effect(() => console.log(double()))
count.update((n) => n + 1)
logger.dispose()

signal, computed, effect

Preact signals
import { computed, effect, signal } from '@preact/signals'

const count = signal(0)
const double = computed(() => count.value * 2)
effect(() => console.log(double.value))
count.value++
Pyreon

Same three names. Drop .value: call the signal to read it, .set or .update to write.

import { computed, effect, signal } from '@pyreon/reactivity'

const count = signal(0)
const double = computed(() => count() * 2)
effect(() => console.log(double()))
count.update((n) => n + 1)
try it

Pick where you're coming from.

Step one is a line of config or an import. Step two, when you are ready, is native Pyreon. An illustrative code diff, not a live migration.

from
step 1 · today · illustrative diff

Swap the import

  • removed: plugins: [react()]
  • added: plugins: [pyreon({ compat: 'react' })]

react, react-dom and the JSX runtime resolve to @pyreon/react-compat. Function components and hooks, React 19 ones included. Class components are stubs. Package: @pyreon/react-compat.

step 2 · before · illustrative

Your React code.

import { useState, useEffect } from 'react'

export function Counter() {
  const [count, setCount] = useState(0)
  useEffect(() => {
    document.title = `Count: ${count}`
  }, [count])
  return <button onClick={() => setCount((n) => n + 1)}>Count: {count}</button>
}
step 2 · after · native Pyreon

The same thing in Pyreon.

import { useHead } from '@pyreon/head'
import { signal } from '@pyreon/reactivity'

export function Counter() {
  const count = signal(0)
  useHead(() => ({ title: `Count: ${count()}` }))
  return <button onClick={() => count.update((n) => n + 1)}>Count: {count()}</button>
}
React example · step 2 before → after · pyreon check
$ pyreon check src/Counter.tsx
src/Counter.tsx
1:0 [react:react-import] (auto-fixable — run with --fix)
Import from 'react' is a React package. Use Pyreon equivalent.
→ import { ... } from "@pyreon/core"
4:28 [react:use-state] (auto-fixable — run with --fix)
useState is a React API. In Pyreon, use signal(). Read: count(), Write: count.set(x)
→ count = signal(0)
5:2 [react:use-effect-deps] (auto-fixable — run with --fix)
useEffect with dependency array. In Pyreon, effect() auto-tracks dependencies — no array needed.
→ effect(() => {
// reads are auto-tracked
})
3 findings in 1 file · some are auto-fixable with --fix
exit 1
[the same file after step 2]
$ pyreon check src/Counter.tsx
✓ no Pyreon anti-patterns in 1 file
exit 0
real output, replayed · captured 2026-11-11 with the worktree CLI on the React pair (pick React above to see the files)
what's included

Everything a migration needs.

  • react-compat 41 exports: use, useActionState, useOptimistic, useSyncExternalStore, Suspense, lazy, portals; createRoot from /dom.
  • preact-compat root, /hooks and /signals entry points; signals keep their .value.
  • vue-compat ref, reactive, computed, watch, effectScope, provide/inject, defineComponent with setup, createApp.
  • solid-compat createSignal, createStore, createResource, and For, Show, Switch, Index, Dynamic.
  • svelte-compat the svelte/store contract (subscribe, set, update, lazy start and stop), lifecycle, context, createEventDispatcher.
  • Vite aliasing compat: 'react' | 'preact' | 'vue' | 'solid' | 'svelte' redirects the imports for you.
  • Scaffold a compat app create-zero --compat react (also vue, solid, preact) starts a Zero app wired for it.
  • Mixed trees nativeCompat lets native Pyreon components and providers sit inside compat code.
  • pyreon check React patterns with line, message and suggested code; --fix applies the first-pass rewrites in place, and setter calls stay for you to finish.
  • MCP tools migrate_react for a first-pass rewrite, migrate_pyreon for sig(v) to sig.set(v) and <For key> to by, validate for what is left.
recipes

Things to build with it.

next release
Run a React app on Pyreon

Swap the React Vite plugin for Pyreon's. Imports from react and react-dom resolve to the compat layer; for TypeScript, map react to the compat package in paths, as examples/compat/react/tsconfig.json does.

// vite.config.ts
import pyreon from '@pyreon/vite-plugin'
import { defineConfig } from 'vite'

export default defineConfig({
  // replaces @vitejs/plugin-react: react, react-dom, react-dom/client
  // and the JSX runtime now resolve to @pyreon/react-compat
  plugins: [pyreon({ compat: 'react' })],
})
List what's left to rewrite

Real output on a React counter. Each finding says what to write instead, and --fix applies the rewrites it marks auto-fixable as a first pass: setter calls stay for you to finish.

$ pyreon check src/Counter.tsx
  src/Counter.tsx
    1:0  [react:react-import] (auto-fixable — run with --fix)
      Import from 'react' is a React package. Use Pyreon equivalent.
      → import { ... } from "@pyreon/core"
    4:28  [react:use-state] (auto-fixable — run with --fix)
      useState is a React API. In Pyreon, use signal(). Read: count(), Write: count.set(x)
      → count = signal(0)
    5:2  [react:use-effect-deps] (auto-fixable — run with --fix)
      useEffect with dependency array. In Pyreon, effect() auto-tracks dependencies — no array needed.
      → effect(() => {
  // reads are auto-tracked
})
    9:12  [react:class-name-prop] (auto-fixable — run with --fix)
      'className' is a React JSX attribute. Use 'class' in Pyreon (standard HTML).
      → class="counter"

  4 findings in 1 file  ·  some are auto-fixable with --fix
# exit code 1: use it as a pre-commit or CI gate
Use a Pyreon provider from React code

Mark a Pyreon component that calls provide, onMount or effect with nativeCompat, and React components below it read its context through their own useContext.

// theme.ts: a native Pyreon provider
import { createContext, nativeCompat, provide } from '@pyreon/core'
import type { VNodeChild } from '@pyreon/core'

export const Theme = createContext<'light' | 'dark'>('light')

// It calls provide(), so mark it: the React-compat JSX runtime
// then calls it as a Pyreon component instead of wrapping it.
export const ThemeProvider = nativeCompat(
  (props: { theme: 'light' | 'dark'; children?: VNodeChild }) => {
    provide(Theme, props.theme)
    return props.children
  },
)

// Badge.tsx: plain React code, reading the Pyreon context
import { useContext } from 'react'
import { Theme } from './theme'

export function Badge() {
  const theme = useContext(Theme)
  return <span className={`badge ${theme}`}>{theme}</span>
}

// <ThemeProvider theme="dark"><Badge /></ThemeProvider>
// renders <span class="badge dark">dark</span>
api

Pick your starting point.

Every export has a reference page with its signature, an example and the mistakes people make with it.

packages · 5
  • @pyreon/react-compat
  • @pyreon/preact-compat
  • @pyreon/vue-compat
  • @pyreon/solid-compat
  • @pyreon/svelte-compat
entry points · 4
  • @pyreon/react-compat/dom
  • @pyreon/preact-compat/hooks
  • @pyreon/preact-compat/signals
  • @pyreon/svelte-compat/store
setup · @pyreon/vite-plugin, @pyreon/core · 2
  • pyreon({ compat })
  • nativeCompat
rewrite tools · pyreon check flags, @pyreon/mcp tools · 5
  • --fix
  • --json
  • migrate_react
  • migrate_pyreon
  • validate
good to know

Good to know before you start.

Nested state resets when a parent re-renders

In react- and preact-compat a parent re-render rebuilds its subtree, so a child's useState and useRef go back to their initial values and useEffect([]) runs again. memo does not stop it. Lift that state up.

Class components

React's Component and PureComponent are import-only stubs. preact-compat runs componentDidMount, componentDidUpdate and componentWillUnmount, but has no class error boundaries.

No concurrent mode

useTransition, useDeferredValue, startTransition and flushSync run synchronously; useLayoutEffect and useInsertionEffect behave like useEffect.

No .vue or .svelte compiler

vue-compat is the Composition API (no Options API, no templates); svelte-compat covers stores and lifecycle, not rune syntax.

Solid and Svelte compat update per component

A change re-runs the component, not one DOM node. In svelte-compat, onDestroy also fires when an ancestor re-renders.

Some React libraries need their vanilla entry

Libraries built on public hooks generally work. zustand/react, heavy react-aria hooks and @xyflow/react do not; use zustand/vanilla or the Pyreon package instead.

The codemod is a first pass

migrate_react rewrites imports, hook declarations and attributes. Setter calls and reads of the old state stay as written, and a useRef becomes a signal, so its .current uses need rewriting too. TypeScript flags the dangling setters and arithmetic on a signal; pyreon check flags a signal left uncalled in a template string.

Dev server needs the next release

The published compat packages ship no jsxDEV, so vite dev renders a blank page; vite build is unaffected. The fix is on main and lands in the next release.

questions

What people ask first.

Will my app behave exactly as it does on React?

No. It is near-full parity with each framework's public API, and each package's README lists where it differs: nested state across parent re-renders, class components, concurrent mode, layout-effect timing.

Will my React libraries work?

Libraries that only use public hooks (useState, useEffect, useReducer, useMemo, useRef) generally do. Libraries that reach into React internals or its scheduler, such as zustand/react, do not; their vanilla entry points do.

Is a compat app as fast as native Pyreon?

We publish no compat benchmark. A compat component re-runs its body on every state change, in the Vue, Solid and Svelte layers too, where the real frameworks update finer than that; a native Pyreon component runs once. The numbers elsewhere on this site are for native Pyreon.

What does migrate_react change today?

On a React counter it turned useState into signal, useEffect into effect, className into class and removed the React import. It left setCount(count + 1) and the reads of count as written, so the file needs those finished by hand before it runs; TypeScript reports setCount as undefined.

Can I mix native Pyreon components into a compat app?

Yes. Pyreon's own providers are marked already; mark your own with nativeCompat when they call provide, onMount or effect.

Does it handle .vue or .svelte files?

No. The Vue and Svelte layers cover what your code imports. Single-file components need their own compiler.

Move the app first. Rewrite it when the roadmap has room.

bun add @pyreon/react-compat @pyreon/vite-plugin
Read the migration guides