Skip to content

Commit 42eb887

Browse files
committed
update
1 parent d42f491 commit 42eb887

2 files changed

Lines changed: 15 additions & 12 deletions

File tree

src/routes/reference/basic-reactivity/create-effect.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,20 @@ description: >-
1717
---
1818

1919
The `createEffect` primitive creates a reactive computation.
20-
It automatically tracks reactive values, such as [signals](/concepts/signals), that are accessed within the provided function.
20+
It automatically tracks reactive values, such as [signals](/concepts/signals), accessed within the provided function.
2121
This function will re-run whenever any of its dependencies change.
2222

2323
## Execution Timing
2424

25-
- The initial execution of an effect is scheduled to occur **after the current rendering phase completes**.
26-
This means it runs after all synchronous code in a component has executed and the DOM elements have been created, but **before the browser renders them on the screen**.
25+
- The initial execution of effects is scheduled to occur **after the current rendering phase completes**.
26+
It runs after all synchronous code in a component has executed and the DOM elements have been created, but **before the browser renders them on the screen**.
2727

2828
As a result, [refs](/concepts/refs) **are set** before the effect runs for the first time, even though the DOM nodes may **not be attached to the main document tree**.
2929
This is particularly relevant when using the [`children`](/reference/component-apis/children) function.
3030

31+
- After the initial execution, effects will re-run whenever any of their dependencies change.
32+
When multiple dependencies are updated within the same batch, the effect will only run once.
3133
- The order in which effects run is **not guaranteed**.
32-
- When multiple dependencies are updated within the same batch, the effect will only run once.
3334
- Effects always run **after** any pure computations (such as [memos](/concepts/derived-values/memos)) within the same update cycle.
3435
- Effects **are not executed** during Server-Side Rendering (SSR) or during the initial client hydration.
3536

@@ -103,7 +104,7 @@ import { createSignal, createEffect } from "solid-js";
103104
function Counter() {
104105
const [count, setCount] = createSignal(0);
105106

106-
// Every time count changes this effect re-runs.
107+
// Every time count changes, this effect re-runs.
107108
createEffect(() => {
108109
console.log("Count incremented! New value: ", count());
109110
});

src/routes/reference/secondary-primitives/create-render-effect.mdx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,22 @@ description: >-
1616
effects as DOM creates, before refs are set or connected.
1717
---
1818

19-
The `createRenderEffect` primitive creates a reactive computation that automatically tracks reactive values, such as signals, accessed within the provided function.
19+
The `createRenderEffect` primitive creates a reactive computation that automatically tracks reactive values, such as [signals](/concepts/signals), accessed within the provided function.
2020
This function re-runs whenever any of its dependencies change.
2121

22-
In contrast to [`createEffect`](/reference/basic-reactivity/create-effect), which executes after the rendering phase is complete, `createRenderEffect` runs immediately during the component's rendering phase.
23-
2422
## Execution Timing
2523

26-
- The initial execution of a render effect occurs **during the current rendering phase**.
27-
It runs while DOM elements are being created and updated, but **before they are mounted**.
24+
- The initial execution of render effects occurs **during the current rendering phase**.
25+
It runs synchronously while DOM elements are being created and updated, but **before they are mounted**.
2826

2927
As a result, refs are **not set** before the render effect runs for the first time.
3028

31-
- After the initial run, the order in which render effects run is **not guaranteed**.
32-
- When multiple dependencies are updated within the same batch, the render effect will only run once.
29+
- After the initial execution, render effects will re-run whenever any of their dependencies change.
30+
31+
The order in which render effects re-run is **not guaranteed**.
32+
33+
When multiple dependencies are updated within the same batch, the render effect will only run once.
34+
3335
- Render effects always run **after** any pure computations (such as [memos](/concepts/derived-values/memos)) within the same update cycle.
3436

3537
## Import

0 commit comments

Comments
 (0)