In other words, invoking the getter creates a subscription. If the value changes, this location needs to be re-evaluated. By retrieving the value from the getter, you are telling the signal that this location is interested in the value. They gain this information by observing in what context the state-getter is invoked. To be reactive, Signals must collect who is interested in the Signal’s value. Signals are reactive! This means that they need to keep track of who is interested in the state (subscriptions) and, if the state changes, notify the subscribers of the state change. The above explains how Signals are different from the good old state but does not explain why we should care.
0 Comments
Leave a Reply. |