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

View file

@ -1,7 +1,8 @@
# Effects
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()`.