Skip to content

Instantly share code, notes, and snippets.

@collin
Last active August 2, 2016 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save collin/4f58855fc90d5c5a49d888354773355d to your computer and use it in GitHub Desktop.
Save collin/4f58855fc90d5c5a49d888354773355d to your computer and use it in GitHub Desktop.
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