Skip to content

Instantly share code, notes, and snippets.

@pburtchaell
Last active August 30, 2018 14:59
Show Gist options
  • Save pburtchaell/46af36a886e032035e60074d446e5990 to your computer and use it in GitHub Desktop.
Save pburtchaell/46af36a886e032035e60074d446e5990 to your computer and use it in GitHub Desktop.
const leftText = "Hello"
// using props.chilren
const Button = (props) => (
<div>
{props.children}
</div>
)
<Button>
{leftText}
</Button>
// OR, but not a good pattern
<Button children={leftText} />
// using props.leftText
const OtherButton = (props) => (
<div>
{props.buttonText}
</div>
)
<OtherButton buttonText={leftText} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment