Last active
August 2, 2016 23:33
-
-
Save collin/4f58855fc90d5c5a49d888354773355d to your computer and use it in GitHub Desktop.
This file contains 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
constructor (props) { | |
var wrappedProps = {}; | |
Object.keys(props).forEach((key) => { | |
wrappedProps[key] = Object.create(props[key]); | |
wrappedProps[key].update = (object) => { | |
Object.assign(props[key], object) | |
this.setState({ wrappedProps }); | |
}; | |
}); | |
super(props); | |
this.state = wrappedProps; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment