Skip to content

deno-mage/preact

Repository files navigation

Emotion logo

Mage

Build web applications with Deno and Preact

Mage Preact

Preact rendering for Mage apps.

Getting started

deno add jsr:@mage/app jsr:@mage/preact npm:preact

Minimal compilerOptions:

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  }
}

An example app:

import { MageApp } from "@mage/app";
import { render } from "@mage/preact";

const app = new MageApp();

app.get("/", async (c) => {
  await render(
    c,
    <html lang="en">
      <head>
        <title>Hello, world!</title>
      </head>
      <body>
        <h1>Hello, world!</h1>
      </body>
    </html>,
  );
});

Deno.serve(app.handler);

Run the app:

deno run --allow-all main.ts

About

Server render Preact apps in Mage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published