Skip to content

Instantly share code, notes, and snippets.

@franleplant
Created September 5, 2016 17:55
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 franleplant/6e1e15c0d347e6d534fe9a2931a8937d to your computer and use it in GitHub Desktop.
Save franleplant/6e1e15c0d347e6d534fe9a2931a8937d to your computer and use it in GitHub Desktop.
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