Created
August 6, 2015 16:12
-
-
Save myndzi/ed37fedd4c1957f29d1b 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 DocumentEdit = React.createClass({ | |
mixins: [CoerceDocumentMixin, PerfMixin], | |
.... | |
}); |
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
module.exports = { | |
getInitialState() { | |
return { | |
document: this._coerceDocument(this.props.document) | |
} | |
}, | |
_updateDocument(doc) { | |
this.setState({ | |
document: _coerceDocument(doc) | |
}); | |
}, | |
_coerceDocument(data) { | |
var doc = Object.assign({ }, this.state.document, data); | |
//... do stuff to 'doc' | |
return doc; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment