From 682b3dfcffdbb4c8965e38a2208b87f354ae9829 Mon Sep 17 00:00:00 2001 From: littensy <56808540+littensy@users.noreply.github.com> Date: Mon, 3 Nov 2025 00:47:35 -0800 Subject: [PATCH] docs: simplify examples --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 8ba7908..d73f64a 100644 --- a/README.md +++ b/README.md @@ -801,13 +801,15 @@ Check out this simple [example project →](https://github.com/littensy/charm-ex ### React Counter ```luau -local counterStore = require("./stores/counterStore") +local getCounter, setCounter = signal(0) local function Counter() - local count = useSignalState(counterStore.getCounter) + local count = useSignalState(getCounter) return React.createElement("TextButton", { - [React.Event.Activated] = counterStore.incrementCounter, + [React.Event.Activated] = function() + setCounter(count + 1) + end, Text = `Count: {count}`, Size = UDim2.fromOffset(100, 50), }) @@ -817,13 +819,17 @@ end ### Vide Counter ```luau -local counterStore = require("./stores/counterStore") +local getCounter, setCounter = signal(0) local function Counter() - local count = useSignalState(counterStore.getCounter) + local count = useSignalState(getCounter) return create "TextButton" { - Activated = counterStore.incrementCounter, + Activated = function() + setCounter(function(count) + return count + 1 + end) + end, Text = function() return `Count: {count()}` end,