Skip to content

Commit c37829f

Browse files
committed
examples section
1 parent 08f03cd commit c37829f

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,25 @@ Returns a tuple `[getter, setter]` where:
9999
- **getter**: An accessor function that returns the current value and tracks dependencies when called within a reactive context
100100
- **setter**: A function that updates the signal's value and notifies all dependent computations
101101

102-
## Usage
102+
## Examples
103+
104+
### Basic Usage
105+
106+
```tsx
107+
import { createSignal } from "solid-js";
108+
109+
function Counter() {
110+
const [count, setCount] = createSignal(0);
111+
112+
return (
113+
<div>
114+
<button onClick={() => setCount(count() + 1)}>+</button>
115+
<span>{count()}</span>
116+
</div>
117+
);
118+
}
119+
120+
```
103121

104122
## How It Works
105123

0 commit comments

Comments
 (0)