Created
March 1, 2017 03:37
-
-
Save beardedtim/3905ff387faff986762cf13c7ff58ff3 to your computer and use it in GitHub Desktop.
Comments: there is no end
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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