From 4a8b70fec5c5cb086167d8a1a34b0389187a76de Mon Sep 17 00:00:00 2001 From: Darragh Griffin Date: Thu, 2 May 2019 18:57:12 +0100 Subject: [PATCH] Change misleading code in Roact.Change example (#196) GetPropertyChangedSignal does not pass the new value of the property to the function and the Roact.Change handler doesn't add this functionality so the current example code is slightly misleading. --- docs/api-reference.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/api-reference.md b/docs/api-reference.md index f2b30ad6..f12eb796 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -142,8 +142,8 @@ It's similar to `Roact.Event`: ```lua Roact.createElement("ScrollingFrame", { - [Roact.Change.CanvasPosition] = function(rbx, position) - print("ScrollingFrame scrolled to", position) + [Roact.Change.CanvasPosition] = function(rbx) + print("ScrollingFrame scrolled to", rbx.CanvasPosition) end, }) ``` @@ -395,4 +395,4 @@ end As with `setState`, you can set use the constant `Roact.None` to remove a field from the state. !!! note - `getDerivedStateFromProps` is a *static* lifecycle method. It does not have access to `self`, and must be a pure function. \ No newline at end of file + `getDerivedStateFromProps` is a *static* lifecycle method. It does not have access to `self`, and must be a pure function.