Skip to content

Instantly share code, notes, and snippets.

@kilgarenone
Last active November 25, 2018 04:33
Show Gist options
  • Save kilgarenone/97b00a1808caeb5641543532625494a8 to your computer and use it in GitHub Desktop.
Save kilgarenone/97b00a1808caeb5641543532625494a8 to your computer and use it in GitHub Desktop.
consume render props
// destructure the object given when called in the <Hello />,
// then pass those properties to our <CustomComponent /> to be consumed.
// The 'isSubmitting' value will be toggled and consumed accordingly too!
<Hello>
{({
handleThisClick,
handleFormSubmit,
isSubmitting
}) => (
<CustomComponent
handleThisClick={handleThisClick}
handleFormSubmit={handleFormSubmit}
isSubmitting={isSubmitting}
/>
)}
</Hello>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment