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 --- .../src/components/preact/PreactCounter.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/framework-multiple/src/components/preact/PreactCounter.tsx (limited to 'examples/framework-multiple/src/components/preact') diff --git a/examples/framework-multiple/src/components/preact/PreactCounter.tsx b/examples/framework-multiple/src/components/preact/PreactCounter.tsx new file mode 100644 index 000000000..5ad164cc2 --- /dev/null +++ b/examples/framework-multiple/src/components/preact/PreactCounter.tsx @@ -0,0 +1,22 @@ +/** @jsxImportSource preact */ + +import { useState } from 'preact/hooks'; +import type { ComponentChildren } from 'preact'; + +/** A counter written with Preact */ +export function PreactCounter({ children }: { children?: ComponentChildren }) { + const [count, setCount] = useState(0); + const add = () => setCount((i) => i + 1); + const subtract = () => setCount((i) => i - 1); + + return ( + <> +
+ +
{count}
+ +
+
{children}
+ + ); +} -- cgit v1.2.3