You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/TYPES.md
+17-4Lines changed: 17 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,9 +48,9 @@ Namely...
48
48
49
49
| Type | Desc |
50
50
| ---- | ---- |
51
-
|`ComponentScope.DuringCallbackU[P, S, +B]`| An unmounted component's `this` scope. |
52
-
|`ComponentScope.DuringCallbackM[P, S, +B]`| A mounted component's `this` scope. |
53
-
|`ComponentScope.WillUpdate[P, S, +B, +N]`| A component's `this` scope during `componentWillUpdate`. |
51
+
|`CompScope.DuringCallbackU[P, S, +B]`| An unmounted component's `this` scope. |
52
+
|`CompScope.DuringCallbackM[P, S, +B]`| A mounted component's `this` scope. |
53
+
|`CompScope.WillUpdate[P, S, +B, +N]`| A component's `this` scope during `componentWillUpdate`. |
54
54
|`BackendScope[P, S]`| A component's `this` scope as is available to backends. |
55
55
56
56
For using JS React Components, you can use follow facade interfaces.
@@ -95,10 +95,23 @@ One of the suffixes below can be added to any the ReactEvents above, to provide
95
95
96
96
For example, `ReactDragEventI` is a `ReactDragEvent` over a `HTMLInputElement` (an `<input>`), the same as writing `SyntheticDragEvent[HTMLInputElement]`.
97
97
98
+
### Component-scope access
99
+
100
+
To prevent issues such as
101
+
backends' props/state being used in such a way that they go stale at runtime (a suprisingly easy mistake to make),
102
+
component/backend scope access is as follows:
103
+
104
+
| Method |`BackendScope`| During Callback | External Access |
105
+
| --- | --- | --- | --- |
106
+
|`.props`|`CallbackTo[P]`|`P`|`P`|
107
+
|`.state`|`CallbackTo[S]`|`S`|`S`|
108
+
|`.setState`|`Callback`|`Callback`|`Unit`|
109
+
|`.modState`|`Callback`|`Callback`|`Unit`|
110
+
|`.forceUpdate`|`Callback`|`Callback`|`Unit`|
111
+
98
112
# Other
99
113
100
114
| Type | Desc |
101
115
| ---- | ---- |
102
-
|`ComponentStateFocus[T]`| Rather than give functions full access to a components state, you can narrow the state down to a subset and pass that around via this type. |
103
116
|`Ref[+N]`| A named reference to an element in a React VDOM. (See [React: More About Refs](https://facebook.github.io/react/docs/more-about-refs.html).) |
104
117
|`RefP[I, +N]`| As above but references multiple, related DOM elements and requires a parameter `I` (usually an ID) to disambiguate. |
0 commit comments