summaryrefslogtreecommitdiff
path: root/examples/framework-preact/src/components
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-09-22 10:32:42 -0400
committerGravatar GitHub <noreply@github.com> 2022-09-22 10:32:42 -0400
commit25a5b9a89aee81c87affca64e1682ebc0c553eaf (patch)
treed635f1f003f7f3eff5ee6516387f7ba1a4066c62 /examples/framework-preact/src/components
parentd650a1161a0288f8f2d35ae67771279d067920e9 (diff)
downloadastro-25a5b9a89aee81c87affca64e1682ebc0c553eaf.tar.gz
astro-25a5b9a89aee81c87affca64e1682ebc0c553eaf.tar.zst
astro-25a5b9a89aee81c87affca64e1682ebc0c553eaf.zip
Revert preact signals support (#4843)
* Revert "Update preact example to match @astrojs/preact ranges (#4840)" This reverts commit d650a1161a0288f8f2d35ae67771279d067920e9. * Revert "[ci] format" This reverts commit e3c78c5b164c338389c437743ba02a7be64e27fb. * Revert "Support shared signals in Preact islands (#4763)" This reverts commit 5e46be54683592773e6dfc2d33825493886114b0.
Diffstat (limited to 'examples/framework-preact/src/components')
-rw-r--r--examples/framework-preact/src/components/Counter.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/framework-preact/src/components/Counter.tsx b/examples/framework-preact/src/components/Counter.tsx
index 5d702fb42..61a9f9d5a 100644
--- a/examples/framework-preact/src/components/Counter.tsx
+++ b/examples/framework-preact/src/components/Counter.tsx
@@ -1,9 +1,11 @@
import { h, Fragment } from 'preact';
+import { useState } from 'preact/hooks';
import './Counter.css';
-export default function Counter({ children, count }) {
- const add = () => count.value++;
- const subtract = () => count.value--;
+export default function Counter({ children }) {
+ const [count, setCount] = useState(0);
+ const add = () => setCount((i) => i + 1);
+ const subtract = () => setCount((i) => i - 1);
return (
<>