# Preact with Inertia Phoenix

December 17, 2025


Out-of-the-box, [inertia-phoenix](https://github.com/inertiajs/inertia-phoenix) offers a great React installer:

```shell
mix archive.install hex igniter_new
mix igniter.install inertia --client-framework=react --typescript
```

Now, there are only 3 steps left to start using Preact in this project:

1. Install Preact

```shell
npm install preact && npm remove react-dom react
```

2. Register paths in tsconfig:

```json
{
  "compilerOptions": {
    // ...
    "paths": {
      "react": ["./node_modules/preact/compat/"],
      "react/jsx-runtime": ["./node_modules/preact/jsx-runtime"],
      "react-dom": ["./node_modules/preact/compat/"],
      "react-dom/*": ["./node_modules/preact/compat/*"]
    }
```

3. Register aliases in in `config.exs` esbuild flags

```diff
- js/app.jsx ... 
+ js/app.jsx --alias:react=preact/compat --alias:react-dom=preact/compat ...
```

> **Note:** while Inertia.js doesn't provide a dedicated Preact client, the regular React client works well under Preact's compatibility mode.

Happy MPA+SPA-ing 🙂 ✌️
