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
@@ -0,0 +1,5 @@
import { HookIsland } from "../../islands/HookIsland.tsx";
export default function Page() {
return <HookIsland />;
}
@@ -0,0 +1,6 @@
import { useReducer } from "preact/hooks";
export default function Page() {
useReducer(() => {}, undefined);
return <h1>useReducer</h1>;
}
@@ -0,0 +1,6 @@
import { useState } from "preact/hooks";
export default function Page() {
useState();
return <h1>useState</h1>;
}