From d243d1a7ac05c30a5fd3708bb060bb065e3ca7e1 Mon Sep 17 00:00:00 2001 From: PGimenez Date: Tue, 10 Dec 2024 21:18:28 +0100 Subject: [PATCH] update readme example --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c916997..e9cd6a9 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This package implements a reactive graph-based state management system where val - **Effect**: callback that run when its dependent signals change. Simple example: + ```julia using StateSignals x = Signal(1) @@ -17,7 +18,5 @@ y = Signal(2) z = computed(() -> x() + y()) # z is 3 effect(() -> println("Sum changed to: ", z())) -x(5) -z() # Prints "Sum changed to: 7" +x(5) # Prints "Sum changed to: 7" ``` -Note that, as of now, a signal's value is only updated when calling its getter. Similarly, effects are called when the signal's value is retrieved.