From e534825d83fef22e3e05d5bab3cd0c64ca698191 Mon Sep 17 00:00:00 2001 From: natxocc Date: Sat, 4 Apr 2026 14:57:50 +0200 Subject: [PATCH] UPdate quick --- docs/api/quick.md | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/docs/api/quick.md b/docs/api/quick.md index 80f59f0..00f4fab 100644 --- a/docs/api/quick.md +++ b/docs/api/quick.md @@ -26,6 +26,11 @@ Explore the reactive building blocks of SigPro. (function) => Computed Creates a Computed Signal that auto-updates when dependencies change. + + $$(obj) + (object) => Proxy + Creates a Deep Reactive Proxy. Track nested property access automatically. No need for manual signals. + $watch(fn) (function) => stopFn @@ -62,6 +67,39 @@ Explore the reactive building blocks of SigPro. --- +## Reactive Proxies ($$) + +The `$$()` function creates a deep reactive proxy that automatically tracks nested property access. + +```javascript +// Create a reactive object +const state = $$({ + user: { + name: "John", + address: { city: "Madrid" } + }, + count: 0 +}); + +// Watch changes automatically +$watch(() => { + console.log(state.user.name); // Auto-tracked + console.log(state.count); // Auto-tracked +}); + +// Mutations trigger updates +state.count = 5; // Triggers re-render +state.user.name = "Ana"; // Deep property also tracked! +``` + +**Benefits over manual signals:** +- No need for `$()` wrappers on every property +- Deep nesting works automatically +- Cleaner, more natural syntax +- Perfect for complex state objects + +--- + ## Element Constructors (Tags) SigPro provides **PascalCase** wrappers for all standard HTML5 tags (e.g., `Div`, `Span`, `Button`). @@ -113,5 +151,9 @@ SigPro provides **PascalCase** wrappers for all standard HTML5 tags (e.g., `Div` > [!IMPORTANT] > **Performance Hint:** For lists (`$for`), always provide a unique key function `(item) => item.id` to prevent unnecessary node creation and enable reordering. -> [!TIP] +> [!TIP] +> **Pro Tip:** Use `$$()` for complex nested state objects instead of multiple `$()` signals. It's cleaner and automatically tracks deep properties. + +> [!TIP] > **Performance Hint:** Always use functions `() => signal()` for dynamic children to ensure SigPro only updates the specific node and not the whole container. +``` \ No newline at end of file