feat: error if stateful hook is used outside of islands (#1778)

This commit is contained in:
Marvin Hagemeister
2023-09-18 16:25:37 +02:00
committed by GitHub
parent 112d701e5c
commit f9f3cd82ee
9 changed files with 258 additions and 124 deletions
+11
View File
@@ -0,0 +1,11 @@
import { useState } from "preact/hooks";
export function HookIsland() {
const [v, set] = useState(0);
return (
<div>
<p>{v}</p>
<button onClick={() => set((v) => v + 1)}>update</button>
</div>
);
}