Skip to content
Migrate

Bring your React app. Keep shipping while you move.

Point react at @pyreon/react-compat and your hooks, deps arrays and all, run on Pyreon's engine. Then convert one component at a time, with a codemod for the mechanical parts, until the compat layer has nothing left to do.

npm install @pyreon/react-compat
five steps

From React to Pyreon, without a rewrite.

Migrating from React, step by step The five migration steps as a loop: install the compat layer, change two config files, keep shipping, convert one component at a time, switch the compiler on. Six components of an app flip one by one from React-style (the body re-runs) to Pyreon (runs once) while @pyreon/react-compat sits underneath; at the last step the compat layer is switched off and jsxImportSource becomes @pyreon/core. MIGRATE · KEEP SHIPPING WHILE YOU MOVE 1install2two configs3keep shipping4convert5compiler on <Header />React-style · body re-runsPyreon · runs once<Search />React-style · body re-runsPyreon · runs once<Cart />React-style · body re-runsPyreon · runs once<Likes />React-style · body re-runsPyreon · runs once<Profile />React-style · body re-runsPyreon · runs once<Footer />React-style · body re-runsPyreon · runs once @pyreon/react-compat · pyreon({ compat: 'react' })on compat off · jsxImportSource: '@pyreon/core'off convert with the codemod, wrap converted components in nativeCompat() until step 5
The five steps as a loop: an illustration, not a recording.
  1. Install the compat layer

    The React layer plus the Pyreon runtime it sits on. The Vite plugin needs Vite 8. On the published packages vite dev renders a blank page (the compat JSX runtime ships no jsxDEV); vite build works, and the fix is on main for the next release.

    npm install @pyreon/react-compat @pyreon/core @pyreon/reactivity @pyreon/runtime-dom
    npm install -D @pyreon/vite-plugin
  2. Change two config files

    Swap @vitejs/plugin-react for the Pyreon plugin in compat mode. It resolves react, react-dom, react-dom/client and the JSX runtime to the compat package, so your import lines stay as they are, and it renames className and htmlFor on the way through.

    vite.config.ts + tsconfig.json
    // vite.config.ts
    import { defineConfig } from 'vite'
    import pyreon from '@pyreon/vite-plugin'
    
    export default defineConfig({
      plugins: [pyreon({ compat: 'react' })],
    })
    
    // tsconfig.json
    {
      "compilerOptions": {
        "jsx": "react-jsx",
        "jsxImportSource": "@pyreon/react-compat"
      }
    }
  3. Keep shipping

    Function components behave like React: useState returns the value, the body re-runs, deps arrays are honoured. Before you deploy, check the four known gaps: class components are stubs, transitions run synchronously, a child's state resets when its parent re-renders (lift that state up), and libraries that reach into React internals will not run.

  4. Convert one component at a time

    Run the codemod on a file, finish what it reports, and wrap the converted component in nativeCompat() so it runs in Pyreon's setup frame. The compat build skips Pyreon's compiler pass, so write reactive text as an arrow ({() => …}) until step 5.

    Likes.tsx
    import { nativeCompat } from '@pyreon/core'
    import { signal } from '@pyreon/reactivity'
    
    // A converted component inside a compat app: it runs once.
    export const Likes = nativeCompat(function Likes() {
      const likes = signal(0)
      return (
        <button onClick={() => likes.update((n) => n + 1)}>
          {() => `${likes()} likes`}
        </button>
      )
    })
  5. Switch the compiler on

    When no React-style component is left, drop compat from the plugin and set jsxImportSource to @pyreon/core. The compiler now makes {likes()} reactive without the arrow, and the app is plain Pyreon. Moving to Zero's file router is a separate step you can take later.

    vite.config.ts
    // vite.config.ts
    import { defineConfig } from 'vite'
    import pyreon from '@pyreon/vite-plugin'
    
    export default defineConfig({
      plugins: [pyreon()],
    })
tools

Tools for the mechanical part.

migrate_react

@pyreon/mcp

Your AI assistant hands it a React file and gets back useState turned into signal, useMemo into computed, useEffect into effect, useCallback unwrapped to a plain function, className and htmlFor renamed, onChange on inputs turned into onInput, the imports swapped, plus the list of changes it made and the findings it could not fix.

how

Add the server to .mcp.json: { "mcpServers": { "pyreon": { "command": "bunx", "args": ["@pyreon/mcp"] } } }

limits

A first pass that does not run as is: setter calls such as setCount(…) stay dangling, value reads are not turned into calls, a useRef becomes a signal so its .current uses break, and a memo() wrapper can stay in place although the change list says it was removed. .map() lists are flagged for <For> but not rewritten; class components and React-specific libraries are not converted. TypeScript flags the dangling setters; review the diff.

pyreon check --fix

@pyreon/cli

The same detectors in the terminal. It scans your git-changed files (or the paths you pass), prints each finding with its fix, writes the codemod's first-pass rewrites with --fix, and exits non-zero on any finding, so it works as a pre-commit gate.

how

pyreon check src/components/Search.tsx --fix

limits

Applies the same codemod as migrate_react, with the same gaps, and skips a file whose only React habit is a .map() list, an onChange or dangerouslySetInnerHTML.

--compat scaffold

@pyreon/create-zero

Starting a new app next to the old one? The scaffold wires the compat layer into a Zero app for React, Vue, Solid or Preact.

how

npm create @pyreon/zero@latest my-app -- --compat react

limits

The scaffold offers react, vue, solid and preact; Svelte compat is set up by hand through the Vite plugin.

Ship on Pyreon this week. Finish the move when it pays.

npm install @pyreon/react-compat
Read the React migration guide