Skip to content

Instantly share code, notes, and snippets.

@joboccara
Last active April 23, 2021 12:42
Show Gist options
  • Save joboccara/e9d24a2f25b9a86edaa806b6a534c332 to your computer and use it in GitHub Desktop.
Save joboccara/e9d24a2f25b9a86edaa806b6a534c332 to your computer and use it in GitHub Desktop.
const Page = ({ user, children, onLogin, onAddComment }) => {
if (!user.isLoggedIn) {
return (
<Layout>
<h3>Please log in to see and post comments</h3>
<PasswordInput/>
<button onClick={onLogin}>Login!</button>
</Layout>
);
}
return (
<Layout>
<h3>Comments section</h3>
<CommentInput />
<button onClick={onAddComment}>
Add comment
</button>
{children}
</Layout>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment