-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Computed reactive variables and Singleton.
Both are very similar, but Singleton will never re-compute, both are not settable (read-only). Example: ```python from solara.toestand import Computed, Reactive x = Reactive(1) y = Reactive(2) def conditional_add(): if x.value == 0: return 42 else: return x.value + y.value z = Computed(conditional_add) ``` z.value will be lazily executed the first time, and will be updated when one of the dependencies changes.
- Loading branch information
1 parent
58fe1a8
commit eca69f7
Showing
2 changed files
with
120 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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