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: src/routes/reference/components/show.mdx
+7-8Lines changed: 7 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -26,8 +26,7 @@ function Example() {
26
26
27
27
## Keyed rendering
28
28
29
-
When the `keyed` prop is set to `true`, the children of the `<Show>` component are re-rendered every time the `when` prop changes.
30
-
It's important to note that in this case, even if the reference of the `when` prop changes, the children will still re-render.
29
+
When the `keyed` prop is set to `true`, changes to the `when` prop—including reference changes—trigger a re-render of the `<Show>` component’s children.
31
30
32
31
```tsx
33
32
import { createSignal, Show } from"solid-js";
@@ -59,11 +58,11 @@ The `<Show>` component can also accept a render function as its child.
59
58
In this case, the first argument of the render function is an _accessor_ to the `when` prop.
60
59
However, when the `keyed` prop is set to `true`, the argument is the `when` prop itself instead of an accessor.
61
60
62
-
The render function is treated like a separate component.
63
-
A key point to understand is that the render function is wrapped in [`untrack`](/reference/reactive-utilities/untrack).
64
-
As a result, any changes to signals accessed directly within the render function will not trigger updates.
61
+
When a render function is used, it is internally wrapped with [`untrack`](/reference/reactive-utilities/untrack).
62
+
As a result, signals accessed directly within the render function's scope will not react to updates.
65
63
66
-
For example, in the following code, clicking the increment button does not update the count value displayed on the screen because the `count` signal is not tracked.
64
+
For example, in the following code, the count displayed in the first `<Show>` component does not update when the `count` signal changes.
65
+
However, the second `<Show>` component does update since the `count` signal is accessed within a JSX element, which creates a tracking scope.
67
66
68
67
```tsx
69
68
import { createSignal, Show } from"solid-js";
@@ -73,9 +72,9 @@ function RenderFunctionExample() {
0 commit comments