@@ -33,7 +33,7 @@ const juicr = new Juicr({ initialState: { count: 0 } })
33332) Add an action with a name and a function that returns the changed state:
3434` ` ` javascript
3535juicr .action (" count" , (amount ,_state )=> {
36- return { count: count+= amount }
36+ return { count: _state . count += amount }
3737})
3838` ` `
39393) 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(() => {
4848juicr .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
5353For 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
136136constructor (props ) {
137137...
138138this .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` ` `