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: documentation/rendering.md
+23-2Lines changed: 23 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,12 +36,33 @@ While you could use a map function for loops and raw ternary operators of condit
36
36
</ul>
37
37
```
38
38
39
-
The library also includes a couple afterRender hooks.
39
+
The library also includes a couple afterRender directives that can be applied to the each and when control flow.
40
40
41
41
### selectWhen(signal, handler)
42
42
### selectEach(signal, handler)
43
43
44
-
These trigger on the signal to indicate the selected model/s and calls the handler function with associated element, and a boolean to indicate whether the model is selected or not.
44
+
These trigger on the signal to indicate the selected model/s and calls the handler function with associated element, and a boolean to indicate whether the model is selected or not. If the handler is a string instead of a function the default behavior is to toggle a class with the string name.
45
+
46
+
These directives also require setting a model on the child element in order to identify the node.
This merges the changes into the path on the state object. All changes in set operation are applied at the same time so it is often more optimal than replace.
15
+
This merges the changes into the path on the state object. All changes made in a single setState command are applied syncronously (ie all changes see each other at the same time). Changes can take the form of function that passes previous state and returns new state or a value. Objects are always merged.
16
16
17
-
Alternatively if you can do multiple sets in a single call by passing an array of paths and changes.
The function form is not terribly useful top level given Solid's synchronous nature. However, setState also supports nested setting where you can indicate the path to the change. When nested the state you are updating may be other non Object values. Objects are still merged but other values (including Arrays) are replaced.
Path can be string keys, array of keys, wildcards ('*'), iterating objects ({from, to, by}), or filter functions. This gives incredible expressive power to describe state changes.
20
51
21
-
All changes made in a single setState command are applied syncronously (ie all changes see each other at the same time).
0 commit comments