Created
May 21, 2018 12:00
-
-
Save luisivan/1889808bcee18d068c705f687a168ba6 to your computer and use it in GitHub Desktop.
aragon.js example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Listen for events and reduce them to a state | |
const state$ = app.store((state, event) => { | |
// Initial state | |
if (state === null) state = 0 | |
// Build state | |
switch (event.event) { | |
case 'Decrement': | |
state-- | |
break | |
case 'Increment': | |
state++ | |
break | |
} | |
return state | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment