Skip to content

Instantly share code, notes, and snippets.

@3nvi
Created February 28, 2019 08:04
Show Gist options
  • Save 3nvi/8564ecc3a02d78657580021e40f7ea6e to your computer and use it in GitHub Desktop.
Save 3nvi/8564ecc3a02d78657580021e40f7ea6e to your computer and use it in GitHub Desktop.
// Don't do this!
function Component(props) {
const aProp = { someProp: 'someValue' }
return <AnotherComponent style={{ margin: 0 }} aProp={aProp} />
}
// Do this instead :)
const styles = { margin: 0 };
function Component(props) {
const aProp = { someProp: 'someValue' }
return <AnotherComponent style={styles} {...aProp} />
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment