Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7617dfd

Browse files
authored
Update README.md
1 parentbffa1ba commit7617dfd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

‎README.md‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const juicr = new Juicr({ initialState: { count: 0 } })
3333
2) Add an action with a name and a function that returns the changed state:
3434
```javascript
3535
juicr.action("count", (amount,_state)=> {
36-
return { count: count+= amount }
36+
return { count:_state.count+= amount }
3737
})
3838
```
3939
3) Listen to state changes. You can either listen to a single property, an array or use`*` to listen to all changes:
@@ -48,7 +48,7 @@ setInterval(() => {
4848
juicr.dispatch("count",1)
4949
},1000)
5050
```
51-
Play with this example in CodePen.
51+
Play with this example in[CodePen](https://codepen.io/alexfoxy/pen/gyNaYw).
5252
5353
For use with React see #use-with-react--react-native
5454
@@ -136,9 +136,10 @@ Alternatively you could pass the entire juicr to your components and let them ha
136136
constructor(props) {
137137
...
138138
this.state= { username:'', photoUrl:'' }
139-
props.userJuicr.listen(["username","photoUrl", (changedState,_state)=> {
140-
this.setState({...changedState })
141-
})
142-
...
139+
140+
props.userJuicr.listen(["username","photoUrl", (changedState,_state)=> {
141+
this.setState({...changedState })
142+
})
143+
...
143144
}
144145
```

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp