edifice.StateManager.subscribe¶
-
StateManager.
subscribe
(component, key)[source]¶ Subscribes a component to the given key.
This returns a StateValue, which can be dereferenced (via state_value.value) and set (via state_value.set. This triggers a re-render for all subscribed components). All state values produced by this method share the same subscription list. The state value can also be passed to child components, which can subscribe to it without knowing about the underlying StateManager.
- Parameters
component (
Component
) – component to subscribekey (
str
) – key to subscribe to.
- Return type
Any
- Returns
A StateValue