Last active
January 30, 2016 03:03
-
-
Save vonwao/b0afba2678de445a0122 to your computer and use it in GitHub Desktop.
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
import PostList from '../components/postlist/index.jsx'; | |
import {useDeps} from 'react-simple-di'; | |
import {composeWithTracker, composeAll} from 'react-komposer'; | |
export const composer = ({context}, onData) => { | |
const {Meteor, Collections} = context(); | |
if (Meteor.subscribe('posts.list').ready()) { | |
const posts = Collections.Posts.find().fetch(); | |
onData(null, {posts}); | |
} | |
}; | |
export default composeAll( | |
composeWithTracker(composer), | |
useDeps() | |
)(PostList); |
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
import React from 'react'; | |
const PostList = ({posts}) => ( | |
<div> | |
<ul> | |
{posts.map(post => ( | |
<li key={post._id}> | |
<a href={`/post/${post._id}`}>{post.title}</a> | |
</li> | |
))} | |
</ul> | |
</div> | |
); | |
export default PostList; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment