summaryrefslogtreecommitdiff
path: root/examples/framework-preact/src/components/Counter.tsx
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-10-10 09:01:15 -0400
committerGravatar GitHub <noreply@github.com> 2022-10-10 09:01:15 -0400
commitb1964e9e1b7f9178036e266b89d3c8b9cbffd1c6 (patch)
tree950e85912ddfd20a20ca2ac7cec58479b3199da7 /examples/framework-preact/src/components/Counter.tsx
parent2314e48f03249b2eca9f9ceb883d2d20fd6efc51 (diff)
downloadastro-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.tsx8
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 (
<>