Last active
February 9, 2019 14:09
-
-
Save hckhanh/c33cdc507cc26932fb98477624ba5591 to your computer and use it in GitHub Desktop.
higher-order component injected
Raw
CommentList.js
This file contains hidden or 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
Show hidden characters
import React, { Component } from "react"; | |
import DataSource from "../DataSource"; | |
import withSubscription from "./withSubscription"; | |
const Comment = ({ comment }) => <>{comment}</>; | |
class CommentList extends Component { | |
render() { | |
return ( | |
<> | |
{this.props.data.map(comment => ( | |
<Comment comment={comment} key={comment.id} /> | |
))} | |
</> | |
); | |
} | |
} | |
export default withSubscription(CommentList, DataSource => | |
DataSource.getComments() | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment