Skip to content

Instantly share code, notes, and snippets.

@StoneCypher
Created February 21, 2015 23:19
Show Gist options
  • Select an option

  • Save StoneCypher/6a995055d74d0d2856dd to your computer and use it in GitHub Desktop.

Select an option

Save StoneCypher/6a995055d74d0d2856dd to your computer and use it in GitHub Desktop.
<script defer type="text/jsx">
// up button control
var Up = flocks.createClass({
inc: function() { this.fset('value', this.fctx['value'] + 1) },
render: function() { return <button onClick={this.inc}>▲</button>; }
});
// down button control
var Down = flocks.createClass({
dec: function() { this.fset('value', this.fctx['value'] - 1) },
render: function() { return <button onClick={this.dec}>▼</button>; }
});
// the application root control
var SpinnerApp = flocks.createClass({
render: function() { return <div><Up/>{this.fctx['value']}<Down/></div>; }
});
// telling flocks where to put the app control, and what that control is
var FlocksConfig = { target: document.body, control: SpinnerApp };
var InitialState = { value: 0 };
// and mount the app 😄
flocks.mount(FlocksConfig, InitialState);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment