Created
September 14, 2025 19:42
-
-
Save jpike88/e331a783328ba3ee60fa7c34a668ce2a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Signals are basically an encapsulated variable (or state node), which can provide getters/setters against that variable. The reason for this is (in short) is that Signals can act as a means of knowing when to trigger change detection intelligently in the component tree. Previously, ZoneJS would just hook all over the place and fire change detection loads of times even when it's not needed. The result is synchronous, performant, as-needed change detection, making application state management less magical and more transparent. | |
| ``` | |
| const myVariable = 4; | |
| const mySignal = signal(myVariable); | |
| console.info(mySignal()); // 4 | |
| mySignal.set(5); | |
| console.info(mySignal()) // 5 | |
| ``` | |
| But the problem is a Signal must be invoked to get at its variable. Because TypeScript treats Signals as function-like, this creates a range of problems when referencing a signal and forgetting to invoke it. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment