Guest User

Untitled

a guest
May 25th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. // Listen for events and reduce them to a state
  2. const state$ = app.store((state, event) => {
  3. // Initial state
  4. if (state === null) state = 0
  5.  
  6. // Build state
  7. switch (event.event) {
  8. case 'Decrement':
  9. state--
  10. break
  11. case 'Increment':
  12. state++
  13. break
  14. }
  15.  
  16. return state
  17. })
Add Comment
Please, Sign In to add comment