Skip to content

Instantly share code, notes, and snippets.

@benmvp
Last active September 25, 2017 21:40
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 benmvp/b4ddf43acb7c1dbc0ff9ced1aa4a2c02 to your computer and use it in GitHub Desktop.
Save benmvp/b4ddf43acb7c1dbc0ff9ced1aa4a2c02 to your computer and use it in GitHub Desktop.
// pass the children back to the component to be used
// in the final render
const Enhancer = ({render, children, foo}) => (
<div>{render(foo * 2, children)}</div>
)
// ViewComp uses both `render` & `children` 🙃
const ViewComp = () => (
<Enhancer foo={11} render={(value, children) => (<div>{value} - <span>{children}</span></div>)}>
Here's some children content
</Enhancer>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment