stevekrouse-honojsx.web.val.run
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/** @jsxImportSource https://esm.sh/hono@3.9.2/jsx **/
import { Hono } from "https://esm.sh/hono@3.9.2";
import type { FC } from "https://esm.sh/hono@3.9.2/jsx";
const Layout: FC = (props) => {
return (
<html>
<body>{props.children}</body>
</html>
);
};
const Top: FC<{ messages: string[] }> = (props: { messages: string[] }) => {
return (
<Layout>
<h1>Hello Hono!</h1>
<ul>
{props.messages.map((message) => {
return <li>{message}!!</li>;
})}
</ul>
</Layout>
);
};
const app = new Hono();
app.get("/", (c) => {
const messages = ["Good Morning", "Good Evening", "Good Night"];
return c.html(<Top messages={messages} />);
});
export let honoJSX = app.fetch;
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
v1
November 9, 2023