const React = require("react"),
      ffux  = require("../ffux")


const App = React.createClass({
  render() {
    const {counter} = this.props.state
    const {increment, decrement} = this.props.actions.counter
    return (
      <div>
        <div>Counter: {counter}</div>
        <button onClick={increment}>+</button>
        <button onClick={decrement}>-</button>
      </div>
    )
  }
})

const Counter = ffux({
  actions: {
    increment: (state, _) => state + 1,
    decrement: (state, _) => state - 1
  }
})


ffux.run({counter: Counter(0)}, (model) => {
  React.render(<App {...model} />, document.getElementById("app"))
})

@@ -123,16 +123,22 @@
 %7Bcounter
+, step
 %7D = this
@@ -170,16 +170,23 @@
 ncrement
+Counter
 , decrem
@@ -188,16 +188,23 @@
 ecrement
+Counter
 %7D = this
@@ -226,16 +226,83 @@
 counter%0A
+    const %7BincrementStep, decrementStep%7D = this.props.actions.step%0A
     retu
@@ -349,16 +349,30 @@
 counter%7D
+, Step: %7Bstep%7D
 %3C/div%3E%0A 
@@ -404,18 +404,33 @@
 ncrement
-%7D%3E
+Counter%7D%3Ecounter 
 +%3C/butto
@@ -470,190 +470,679 @@
 ment
-%7D%3E-%3C/button%3E%0A      %3C/div%3E%0A    )%0A  %7D%0A%7D)%0A%0Aconst Counter = ffux(%7B%0A  actions: %7B%0A    increment: (state, _) =%3E
+Counter%7D%3Ecounter -%3C/button%3E%0A        %3Cbr /%3E%0A        %3Cbutton onClick=%7BincrementStep%7D%3Estep +%3C/button%3E%0A        %3Cbutton onClick=%7BdecrementStep%7D%3Estep -%3C/button%3E%0A      %3C/div%3E%0A    )%0A  %7D%0A%7D)%0A%0Aconst %7Brun, pure, impure%7D = ffux%0A%0A%0Aconst Counter = ffux(%7B%0A  _increment: pure((%7Bstate, deps: %7Bstep%7D%7D) =%3E state + step.state()),%0A%0A  incrementCounter: impure((%7Bstate, self%7D) =%3E %7B%0A    setTimeout(_ =%3E self._increment(),
  state 
-+ 1,%0A    decrement: (state, _) =%3E state - 1%0A  %7D%0A%7D)%0A%0A%0Affux.run(%7B
+* 100)%0A  %7D),%0A%0A  decrementCounter: pure((%7Bstate, deps: %7Bstep%7D%7D) =%3E state - step.state())%0A%7D)%0A%0Aconst Step = ffux(%7B%0A  incrementStep: pure((%7Bstate%7D) =%3E state + 1),%0A  decrementStep: pure((%7Bstate%7D) =%3E state - 1)%0A%7D)%0A%0A%0A;(function() %7B%0A  const step    = Step(1)%0A  const 
 counter
-:
+ =
  Cou
@@ -1146,18 +1146,49 @@
 Counter(
-0)
+10, %7Bstep%7D)%0A%0A  run(%7Bcounter, step
 %7D, (mode
@@ -1195,16 +1195,18 @@
 l) =%3E %7B%0A
+  
   React.
@@ -1264,11 +1264,18 @@
 %22app%22))%0A
+  
 %7D)%0A
+%7D)()%0A

Update counter example