Fix mistakes in docs

This commit is contained in:
aaron 2024-11-12 15:08:12 +00:00
parent baf308ccf3
commit bacb4fa0f0
8 changed files with 12 additions and 18 deletions

View file

@ -26,9 +26,9 @@ local source = vide.source
local effect = vide.effect
local cleanup = vide.cleanup
local function changed(prop: string, callback: (new) -> ())
local function changed(property: string, callback: (new) -> ())
return action(function(instance)
local connection = instance:GetPropertyChangedSignal(prop):Connect(function()
local connection = instance:GetPropertyChangedSignal(property):Connect(function()
callback(instance[property])
end)

View file

@ -69,7 +69,7 @@ local count = source(0)
root(function()
local text = derive(function()
return "count: " .. text()
return "count: " .. count()
end)
effect(function()

View file

@ -53,7 +53,7 @@ effects depending on it.
You can also read from a source within an effect without the effect tracking it.
```lua
```luau
local source = vide.source
local effect = vide.effect
local untrack = vide.untrack

View file

@ -35,8 +35,6 @@ local function setup()
effect(function()
print(count())
end)
return count
end
setup() -- error, effect() tried to create a reactive scope with no stable scope

View file

@ -34,14 +34,10 @@ count source is created inside the component.
External sources can also be passed into components for them to use.
```luau
local function Counter(props: { count: () -> number })
local function CountDisplay(props: { count: () -> number })
local count = props.count
local instance = create "TextButton" {
Activated = function()
count(count() + 1)
end
}
local instance = create "TextLabel" {}
effect(function()
instance.Text = "count: " .. count()
@ -52,11 +48,11 @@ end
local count = source(0)
Counter {
CountDisplay {
count = count
}
count(1) -- the Counter component will update to display this count
count(1) -- the CountDisplay component will update to display this count
```
Sources can be created internally or passed in from externally, there are no