[XML] Untracked reactive value access #74

Merged
thesabinelim merged 2 commits from untracked into master 2023-05-14 18:15:37 +08:00
thesabinelim commented 2023-05-14 17:45:42 +08:00 (Migrated from github.com)

Allows for accessing reactive values in an unreactive way, not updating after the first access. This by itself is not very useful but it can be used as a building block for more complex behaviour.

<script>
  basalt = require("basalt")
  getCount, setCount = basalt.reactive(0)
</script>

<button text={"Times clicked: " .. getCount()}>
  <onClick>
    setCount(getCount() + 1)
  </onClick>
</button>
<label text={"This value should never update: " .. basalt.untracked(getCount)} />
Allows for accessing reactive values in an unreactive way, not updating after the first access. This by itself is not very useful but it can be used as a building block for more complex behaviour. ```xml <script> basalt = require("basalt") getCount, setCount = basalt.reactive(0) </script> <button text={"Times clicked: " .. getCount()}> <onClick> setCount(getCount() + 1) </onClick> </button> <label text={"This value should never update: " .. basalt.untracked(getCount)} /> ```
Sign in to join this conversation.
No description provided.