From e586d7d704d475afe3373a1de6ae20d504f79d6d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 5 Jun 2025 14:25:23 +0000 Subject: Sync from a8e1c0a7402940e0fc5beef669522b315052df1b --- .../framework-preact/src/components/Counter.tsx | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/framework-preact/src/components/Counter.tsx (limited to 'examples/framework-preact/src/components/Counter.tsx') diff --git a/examples/framework-preact/src/components/Counter.tsx b/examples/framework-preact/src/components/Counter.tsx new file mode 100644 index 000000000..a63bf0cd7 --- /dev/null +++ b/examples/framework-preact/src/components/Counter.tsx @@ -0,0 +1,30 @@ +import type { ComponentChildren } from 'preact'; +import type { Signal } from '@preact/signals'; +import { lazy, Suspense } from 'preact/compat'; +import './Counter.css'; + +const Message = lazy(async () => import('./Message')); +const Fallback = () =>

Loading...

; + +type Props = { + children: ComponentChildren; + count: Signal; +}; + +export default function Counter({ children, count }: Props) { + const add = () => count.value++; + const subtract = () => count.value--; + + return ( + <> +
+ +
{count}
+ +
+ + {children} + + + ); +} -- cgit v1.2.3