Update docs

This commit is contained in:
Aaron Smith 2023-09-26 18:24:30 +01:00
parent c3bc53c40a
commit fd2888afab
2 changed files with 6 additions and 6 deletions

View file

@ -36,8 +36,7 @@ count(1)
print(text()) -- "count: 1" print(text()) -- "count: 1"
``` ```
You may be wondering why we are using sources instead of plain variables to do Derived sources should be pure functions. This is where the same output is
this. The reason is that Vide has an entire reactive system based on sources. always produced for the same input. As well as making source updates more
You can write functions to automatically run each time a source is updated. This predictable, knowing that updates are pure allows Vide to use optimizations such
can be to update properties, create new instances, print to the terminal, etc. as caching, to avoid updating derived sources if their inputs are the same.
How this is done will be covered next.

View file

@ -1,7 +1,8 @@
# Effects # Effects
Effects are functions that are ran in response to source updates. They are Effects are functions that are ran in response to source updates. They are
called effects because they cause *side-effects* when reacting to source updates. called effects because they cause *side-effects* when reacting to source updates
which are pure.
Effects are created using `effect()`. Effects are created using `effect()`.