mirror of
https://github.com/centau/vide.git
synced 2026-08-20 14:41:37 +00:00
Update docs
This commit is contained in:
parent
c3bc53c40a
commit
fd2888afab
2 changed files with 6 additions and 6 deletions
|
|
@ -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.
|
|
||||||
|
|
|
||||||
|
|
@ -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()`.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue