-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample1.tsx
More file actions
44 lines (41 loc) · 982 Bytes
/
Copy pathexample1.tsx
File metadata and controls
44 lines (41 loc) · 982 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
import { h, toString } from "../mod.ts";
function Layout({
title,
children,
}: {
title: string;
children: JSX.Children;
}) {
return (
<html>
<head>
<title>{title} Example</title>
<link rel="stylesheet" href="assets/style.css" />
</head>
<body>
<div className="contents x y" style={{ border: "1px solid green" }}>
<h1
style={{
color: "tomato",
backgroundColor: "#222",
textAlign: "center",
}}
>
Example
</h1>
{children}
{() => (
<div>
This is a deferred component, it will be rendered after all the
other non-deferred elements are rendered to string.
</div>
)}
</div>
</body>
</html>
);
}
const homePage = (
<Layout title={"Home"}>{[<p>This is an example page.</p>]}</Layout>
);
console.log(toString(homePage));