Skip to content

Instantly share code, notes, and snippets.

@beardedtim
Created March 1, 2017 03:37
Show Gist options
  • Save beardedtim/3905ff387faff986762cf13c7ff58ff3 to your computer and use it in GitHub Desktop.
Save beardedtim/3905ff387faff986762cf13c7ff58ff3 to your computer and use it in GitHub Desktop.
Comments: there is no end
const Comment = ({ text, author, _id }) => (
<div key={_id}>
<p>{text}</p>
<h5>{author}</h5>
</div>
);
const CommentList = map(Comment);
const CommentWraper = children => (
<div>
<h2>Comments</h2>
{children}
</div>
)
const wrapComments = compose(
map(CommentWraper),
map(CommentList)
)
const getComments = compose(
wrapComments,
map(prop('comments'))
)
const CommentsWrapper = children => (
<div style={rowStyle}>
{children}
</div>
)
const wrapAllComments = compose(
CommentsWrapper,
getComments,
)
const Comments = compose(
wrapAllComments,
prop('posts')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment