Created
February 21, 2015 23:19
-
-
Save StoneCypher/6a995055d74d0d2856dd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <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