diff options
author | 2022-10-10 09:01:15 -0400 | |
---|---|---|
committer | 2022-10-10 09:01:15 -0400 | |
commit | b1964e9e1b7f9178036e266b89d3c8b9cbffd1c6 (patch) | |
tree | 950e85912ddfd20a20ca2ac7cec58479b3199da7 /examples/framework-preact/src/components/Counter.tsx | |
parent | 2314e48f03249b2eca9f9ceb883d2d20fd6efc51 (diff) | |
download | astro-b1964e9e1b7f9178036e266b89d3c8b9cbffd1c6.tar.gz astro-b1964e9e1b7f9178036e266b89d3c8b9cbffd1c6.tar.zst astro-b1964e9e1b7f9178036e266b89d3c8b9cbffd1c6.zip |
Revert "Revert preact signals support (#4843)" (#5015)
This reverts commit 25a5b9a89aee81c87affca64e1682ebc0c553eaf.
Diffstat (limited to 'examples/framework-preact/src/components/Counter.tsx')
-rw-r--r-- | examples/framework-preact/src/components/Counter.tsx | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/framework-preact/src/components/Counter.tsx b/examples/framework-preact/src/components/Counter.tsx index 61a9f9d5a..5d702fb42 100644 --- a/examples/framework-preact/src/components/Counter.tsx +++ b/examples/framework-preact/src/components/Counter.tsx @@ -1,11 +1,9 @@ import { h, Fragment } from 'preact'; -import { useState } from 'preact/hooks'; import './Counter.css'; -export default function Counter({ children }) { - const [count, setCount] = useState(0); - const add = () => setCount((i) => i + 1); - const subtract = () => setCount((i) => i - 1); +export default function Counter({ children, count }) { + const add = () => count.value++; + const subtract = () => count.value--; return ( <> |