From 25a5b9a89aee81c87affca64e1682ebc0c553eaf Mon Sep 17 00:00:00 2001 From: Matthew Phillips Date: Thu, 22 Sep 2022 10:32:42 -0400 Subject: 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. --- examples/framework-preact/src/components/Counter.tsx | 8 +++++--- examples/framework-preact/src/pages/index.astro | 12 ++---------- 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'examples/framework-preact/src') 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 ( <> diff --git a/examples/framework-preact/src/pages/index.astro b/examples/framework-preact/src/pages/index.astro index b37295d7b..a6565f6c1 100644 --- a/examples/framework-preact/src/pages/index.astro +++ b/examples/framework-preact/src/pages/index.astro @@ -2,12 +2,8 @@ // Component Imports import Counter from '../components/Counter'; -import { signal } from '@preact/signals'; - // Full Astro Component Syntax: // https://docs.astro.build/core-concepts/astro-components/ - -const count = signal(0); --- @@ -29,12 +25,8 @@ const count = signal(0);
- -

Hello, Preact 1!

-
- - -

Hello, Preact 2!

+ +

Hello, Preact!

-- cgit v1.2.3