Created
August 7, 2015 16:58
-
-
Save StoneCypher/93ef8f36eb03902df542 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
| var React = ... | |
| var Editor = React.createClass({ ... }); | |
| var App = { | |
| savedValue : 'Hello, World!', | |
| currentValue : 'Hello, World!', | |
| hot : false, | |
| change : function(X) { this.currentValue = X; hot = true; this.rerender(); }, | |
| save : function(X) { this.savedValue = this.currentValue; hot = false; this.rerender(); }, | |
| abort : function(X) { this.currentValue = this.savedValue; hot = false; this.rerender(); }, | |
| rerender : function(Hot) { React.render(document.body, <Editor hot={this.hot} val={this.currentValue} hooks={...} />); }, | |
| }; | |
| // where hooks is just an object that passes down change, save, and abort | |
| // put these in contexts and you don't even have to pass them down | |
| // and now you use flocks.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment