Skip to content

Commit 90d74c0

Browse files
committed
createSignal updates based on PR feedback
1 parent 969a8dc commit 90d74c0

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ import { createSignal } from "solid-js";
2929
```typescript
3030
function createSignal<T>(): Signal<T | undefined>;
3131
function createSignal<T>(value: T, options?: SignalOptions<T>): Signal<T>;
32-
```
33-
34-
### Related Types
3532

36-
```typescript
3733
type Signal<T> = [get: Accessor<T>, set: Setter<T>];
3834

3935
type Accessor<T> = () => T;
@@ -68,8 +64,6 @@ If no initial value is provided, the signal's type is automatically extended wit
6864
- **Default:** `undefined`
6965

7066
Configuration object for the signal.
71-
In production mode, all debugging metadata is stripped away for optimal performance.
72-
Dev-only options like `name` are ignored, and no warnings are issued, ensuring that your application runs as efficiently as possible.
7367

7468
#### `name`
7569

@@ -84,10 +78,12 @@ It works only in development mode and is removed from the production bundle.
8478
- **Type:** `false | ((prev: T, next: T) => boolean)`
8579
- **Default:** `false`
8680

87-
By default, signals use reference equality (`===`).
88-
A custom comparison function to determine when the signal should update.
89-
If set to `false`, the signal will always update regardless of value equality.
90-
This can be useful to create a Signal that triggers manual updates in the reactive system, but must remain a pure function.
81+
A custom comparison function to determine when the signal should update.
82+
By default, signals use reference equality (`===`) to compare previous and next values.
83+
When set to `false`, the signal will always update regardless of value equality, which is useful for creating signals that trigger manual updates in the reactive system.
84+
85+
When providing a custom function, it should be pure and return `true` if the values are equal (no update needed) or `false` if they differ (trigger update).
86+
Impure functions can create unexpected side effects and performance issues.
9187

9288
#### `internal`
9389

0 commit comments

Comments
 (0)