Skip to content

Instantly share code, notes, and snippets.

@vonwao
Last active January 30, 2016 03:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vonwao/b0afba2678de445a0122 to your computer and use it in GitHub Desktop.
Save vonwao/b0afba2678de445a0122 to your computer and use it in GitHub Desktop.
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);
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