fix: wrong type for html boolean attrs (#1731)

This commit is contained in:
Marvin Hagemeister
2023-09-05 01:00:33 +02:00
committed by GitHub
parent 575e7813b7
commit 63c90ddc67
5 changed files with 182 additions and 63 deletions
+18
View File
@@ -0,0 +1,18 @@
import { useEffect, useRef } from "preact/hooks";
import { ComponentChildren } from "preact";
export function FormIsland({ children }: { children: ComponentChildren }) {
const ref = useRef<HTMLParagraphElement | null>(null);
useEffect(() => {
if (!ref.current) return;
ref.current.textContent = "Revived: true";
}, []);
return (
<form onSubmit={(e) => e.preventDefault()}>
<p class="form-revived" ref={ref}>Revived: false</p>
{children}
</form>
);
}