Created
September 5, 2016 17:55
-
-
Save franleplant/6e1e15c0d347e6d534fe9a2931a8937d 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
class MyComp extends React.Component { | |
render() { | |
// copy props shallowly, you can use other technics such as lodash cloneDeep, et al | |
// Why do this? because props are inmutable | |
let props = Object.assign({}, this.props); | |
delete props.unwantedProp1 | |
... | |
delete props.unwantedPropN | |
// You can also achieve all this with lodash.omit | |
return <input {...props} /> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment