Skip to content

Instantly share code, notes, and snippets.

@ohAitch
Created April 2, 2016 20:48
Show Gist options
  • Save ohAitch/2a34fd712a0212f75c4f33df52fad21c to your computer and use it in GitHub Desktop.
Save ohAitch/2a34fd712a0212f75c4f33df52fad21c to your computer and use it in GitHub Desktop.
fooBarReducer = (fooBar=0,{addFooBar,clearFooBar})->
switch
when addFooBar? then fooBar + addFooBar
when clearFooBar? then 0
else fooBar
connect(({fooBar})-> count: fooBar) ({count, dispatch})->
div {},
button {onClick: -> dispatch addFooBar:5}, "Bump ", count
button {onClick: -> dispatch clearFooBar:yes}, "Reset"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment