Skip to content

Commit 95966b4

Browse files
committed
feat: createMemo
1 parent a5145bb commit 95966b4

3 files changed

Lines changed: 271 additions & 95 deletions

File tree

‎README.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,19 @@ This library provides:
1818

1919
```tsx
2020
function Counter() {
21-
const [counter, setCounter] = createState(0)
21+
const [count, setCount] = createState(0)
2222

2323
function increment() {
24-
setCounter((v) => v + 1)
24+
setCount((v) => v + 1)
2525
}
2626

27+
createEffect(() => {
28+
console.log("count is", count())
29+
})
30+
2731
return (
2832
<Gtk.Box spacing={8}>
29-
<Gtk.Label label={counter((c) => c.toString())} />
33+
<Gtk.Label label={count((c) => c.toString())} />
3034
<Gtk.Button onClicked={increment}>Increment</Gtk.Button>
3135
</Gtk.Box>
3236
)

‎src/index.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export {
2828
createState,
2929
createEffect,
3030
createComputed,
31+
createMemo,
3132
createBinding,
3233
createConnection,
3334
createExternal,

0 commit comments

Comments
 (0)