Skip to content

Instantly share code, notes, and snippets.

@treyhuffine
Created February 27, 2018 13:05
Show Gist options
  • Save treyhuffine/25a8441630fd9770eab8b8a9142654c4 to your computer and use it in GitHub Desktop.
Save treyhuffine/25a8441630fd9770eab8b8a9142654c4 to your computer and use it in GitHub Desktop.
import React from 'react';
const SECRET_TO_LIFE = 42;
class ShareSecretToLife extends React.Component {
render() {
return (
<div>
{this.props.render({ secretToLife: SECRET_TO_LIFE })}
</div>
);
}
}
const ShareSecretWithWorld = () => (
<ShareSecretToLife
render={({ secretToLife }) => (
<h1>
<b>{secretToLife}</b>
</h1>
)}
/>
);
// This will return:
// <div>
// <h1>
// <b>
// 42
// </b>
// </h1>
// </div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment