From fd2888afabc7691cb7655c8c0ae219f2eb912c75 Mon Sep 17 00:00:00 2001 From: Aaron Smith <83140718+centau@users.noreply.github.com> Date: Tue, 26 Sep 2023 18:24:30 +0100 Subject: [PATCH] Update docs --- docs/tut/crash-course/4-source.md | 9 ++++----- docs/tut/crash-course/5-effect.md | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/tut/crash-course/4-source.md b/docs/tut/crash-course/4-source.md index b7f7d04..4419b72 100644 --- a/docs/tut/crash-course/4-source.md +++ b/docs/tut/crash-course/4-source.md @@ -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. diff --git a/docs/tut/crash-course/5-effect.md b/docs/tut/crash-course/5-effect.md index f75d21a..406ccd2 100644 --- a/docs/tut/crash-course/5-effect.md +++ b/docs/tut/crash-course/5-effect.md @@ -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()`.