Skip to content

Commit 5398399

Browse files
authored
docs: fix typo in how-valtio-works.mdx (#783)
* docs: fix typo in how-valtio-works.mdx * docs: fix typo in how-valtio-works.mdx
1 parent 4f4404d commit 5398399

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/how-tos/how-valtio-works.mdx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ This is to describe the high level abstraction of valtio.
2121
import { proxy, subscribe } from 'valtio'
2222

2323
const s1 = proxy({})
24-
subscribe(s1, () => { console.log('s1 is changed!') })
24+
subscribe(s1, () => {
25+
console.log('s1 is changed!')
26+
})
2527
s1.a = 1 // s1 is changed!
2628
++s1.a // s1 is changed!
2729
delete s1.a // s1 is changed!
@@ -30,11 +32,15 @@ s1.b = 2 // (not changed)
3032
s1.obj = {} // s1 is changed!
3133
s1.obj.c = 3 // s1 is changed!
3234
const s2 = s1.obj
33-
subscribe(s2 () => { console.log('s2 is changed!') })
35+
subscribe(s2, () => {
36+
console.log('s2 is changed!')
37+
})
3438
s1.obj.d = 4 // s1 is changed! and s2 is changed!
3539
s2.d = 5 // s1 is changed! and s2 is changed!
3640
const s3 = proxy({})
37-
subscribe(s3 () => { console.log('s3 is changed!') })
41+
subscribe(s3, () => {
42+
console.log('s3 is changed!')
43+
})
3844
s1.o = s3
3945
s3.p = 'hello' // s1 is changed! and s3 is changed!
4046
s2.q = s3

0 commit comments

Comments
 (0)