Skip to content

Commit 4045d18

Browse files
committed
update
1 parent 890f5bb commit 4045d18

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/routes/reference/lifecycle/on-mount.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ function onMount(fn: () => void): void;
3737
- **Type:** `() => void`
3838
- **Required:** Yes
3939

40-
Function executed once on mount.
40+
Non-tracking function executed once on mount.
4141

4242
## Return value
4343

4444
`onMount` does not return a value.
4545

4646
## Behavior
4747

48-
- Runs once after the initial render.
49-
- Does not track reactive dependencies inside `fn`.
48+
- On the client, `onMount` runs once after the initial render. It does not run during server rendering.
49+
- `fn` does not track reactive dependencies.
5050
- Internally, `onMount(fn)` is equivalent to `createEffect(() => untrack(fn))`.
51-
- Runs after refs have been assigned.
51+
- By the time `onMount` runs, refs have already been assigned.
5252

5353
## Examples
5454

@@ -75,6 +75,7 @@ import { onMount } from "solid-js";
7575

7676
function Example() {
7777
onMount(() => {
78+
// Browser-only code
7879
console.log(window.location.pathname);
7980
});
8081

0 commit comments

Comments
 (0)