Skip to content

Commit cdf2b01

Browse files
committed
update
1 parent 800c418 commit cdf2b01

2 files changed

Lines changed: 32 additions & 30 deletions

File tree

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

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ description: >-
1717
---
1818

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

2323
## Execution Timing
2424

25-
- The initial run of an effect is scheduled to run **after the current rendering phase completes**.
26-
- This means it runs after all synchronous code in a component has been executed and the DOM elements have been created, but **before the browser paints them to the screen**.
27-
- 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**.
28-
This is particularly relevant when using [`children`](/reference/component-apis/children).
29-
- If multiple dependencies are updated within the same batch, the effect only runs once.
30-
- Effects always run **after** any pure computations (like [memos](/concepts/derived-values/memos)) in the same update cycle.
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**.
27+
28+
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**.
29+
This is particularly relevant when using the [`children`](/reference/component-apis/children) function.
30+
3131
- The order in which effects run is **not guaranteed**.
32-
- Effects are **not run** during Server-Side Rendering (SSR) or the initial client hydration.
32+
- When multiple dependencies are updated within the same batch, the effect will only run once.
33+
- Effects always run **after** any pure computations (such as [memos](/concepts/derived-values/memos)) within the same update cycle.
34+
- Effects **are not executed** during Server-Side Rendering (SSR) or during the initial client hydration.
3335

3436
## Import
3537

@@ -62,16 +64,16 @@ function createEffect<Next, Init>(
6264
- **Type:** `EffectFunction<undefined | NoInfer<Next> | EffectFunction<Init | Next, Next>`
6365
- **Required:** Yes
6466

65-
The function to run.
66-
It receives the value returned from the previous run, or the initial `value` on the first run.
67-
The value it returns is passed to the next run.
67+
The function to execute as the effect.
68+
It receives the value returned from the previous execution, or the initial `value` during its first run.
69+
The value returned by this function will be passed to the next execution.
6870

6971
### `value`
7072

7173
- **Type:** `Init`
7274
- **Required:** No
7375

74-
The initial value passed to `fn` on its first run.
76+
The initial value that is passed to `fn` during its first execution.
7577

7678
### `options`
7779

@@ -85,7 +87,7 @@ An optional configuration object with the following properties:
8587
- **Type:** `string`
8688
- **Required:** No
8789

88-
A name for the effect, used for identification in debugging tools like [Solid Debugger](https://github.com/thetarnav/solid-devtools).
90+
A name for the effect, which can be useful for identification in debugging tools like the [Solid Debugger](https://github.com/thetarnav/solid-devtools).
8991

9092
## Return value
9193

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ tags:
1010
- immediate
1111
- refs
1212
- lifecycle
13-
version: '1.0'
13+
version: "1.0"
1414
description: >-
1515
Execute effects immediately during rendering with createRenderEffect. Run side
1616
effects as DOM creates, before refs are set or connected.
1717
---
1818

19-
The `createRenderEffect` primitive creates a reactive computation.
20-
It automatically tracks reactive values, such as signals, that are accessed within the provided function.
19+
The `createRenderEffect` primitive creates a reactive computation that automatically tracks reactive values, such as signals, accessed within the provided function.
2120
This function re-runs whenever any of its dependencies change.
2221

23-
Unlike [`createEffect`](/reference/basic-reactivity/create-effect), which runs after the rendering phase is complete, `createRenderEffect` runs immediately as the component is being rendered.
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.
2423

2524
## Execution Timing
2625

27-
- The initial run of a render effect happens during the current rendering phase.
28-
- It runs as DOM elements are being created and updated, but before they are mounted.
29-
As a result, refs are _not_ set before a render effect runs for the first time.
30-
- If multiple dependencies are updated within the same batch, the render effect only runs once.
31-
- Effects always run after any pure computations (like [memos](/concepts/derived-values/memos)) in the same update cycle.
32-
- The order in which render effects run is not guaranteed.
33-
- Render effects are not run during Server-Side Rendering (SSR).
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**.
28+
29+
As a result, refs are **not set** before the render effect runs for the first time.
30+
31+
- After the initial run, the order in which render effects run is **not guaranteed**.
32+
- If multiple dependencies are updated within the same batch, the render effect runs only once.
33+
- Render effects always run **after** any pure computations (such as [memos](/concepts/derived-values/memos)) within the same update cycle.
3434

3535
## Import
3636

@@ -63,16 +63,16 @@ function createRenderEffect<Next, Init>(
6363
- **Type:** `EffectFunction<undefined | NoInfer<Next> | EffectFunction<Init | Next, Next>`
6464
- **Required:** Yes
6565

66-
The function to run.
67-
It receives the value returned from the previous run, or the initial `value` on the first run.
68-
The value it returns is passed to the next run.
66+
The function to execute as the render effect.
67+
It receives the value returned from the previous execution, or the initial `value` during its the first run.
68+
The value returned by this function will be passed to the next execution.
6969

7070
### `value`
7171

7272
- **Type:** `Init`
7373
- **Required:** No
7474

75-
The initial value passed to `fn` on its first run.
75+
The initial value that is passed to `fn` during its first execution.
7676

7777
### `options`
7878

@@ -86,7 +86,7 @@ An optional configuration object with the following properties:
8686
- **Type:** `string`
8787
- **Required:** No
8888

89-
A name for the render effect, used for identification in debugging tools like [Solid Debugger](https://github.com/thetarnav/solid-devtools).
89+
A name for the render effect, which can be useful for identification in debugging tools like the [Solid Debugger](https://github.com/thetarnav/solid-devtools).
9090

9191
## Return value
9292

0 commit comments

Comments
 (0)