fix: make <Head> work in client (#3252)
Closes #3310 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Bartek Iwańczuk
Claude Opus 4.6
parent
19d3589b9b
commit
a79b155e79
@@ -0,0 +1,23 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
|
||||
export function HeadCounter() {
|
||||
const [ready, setReady] = useState(false);
|
||||
const [v, set] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
setReady(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div class={ready ? "ready" : "not-ready"}>
|
||||
<Head>
|
||||
<title>Count: {v}</title>
|
||||
</Head>
|
||||
<p class="result">Count: {v}</p>
|
||||
<button type="button" onClick={() => set((v) => v + 1)}>
|
||||
update
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { useEffect, useState } from "preact/hooks";
|
||||
import { Head } from "fresh/runtime";
|
||||
|
||||
export function HeadMeta() {
|
||||
const [ready, setReady] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
setReady(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div class={ready ? "ready" : "not-ready"}>
|
||||
<Head>
|
||||
<meta name="custom" content="ok" />
|
||||
<meta name="custom-new" content="ok" />
|
||||
</Head>
|
||||
<h1>check meta</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user