Skip to content

Instantly share code, notes, and snippets.

@luisivan
Created May 21, 2018 12:00
Show Gist options
  • Save luisivan/1889808bcee18d068c705f687a168ba6 to your computer and use it in GitHub Desktop.
Save luisivan/1889808bcee18d068c705f687a168ba6 to your computer and use it in GitHub Desktop.
aragon.js example
// 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