Vulcan/packages/telescope-posts/lib/containers/PostContainer.jsx

35 lines
601 B
React
Raw Normal View History

// import React from 'react';
2016-02-16 15:08:30 +09:00
const PostContainer = React.createClass({
// propTypes: {
// },
mixins: [ReactMeteorData],
getMeteorData() {
2016-02-16 15:08:30 +09:00
const subscription = Meteor.subscribe('posts.single', this.props._id);
return {
post: Posts.findOne(this.props._id)
};
},
render() {
2016-02-16 15:08:30 +09:00
const PostComponent = Telescope.getComponent(this.props.component); // could be Post or PostEdit
if (this.data.post) {
return (
2016-02-16 15:08:30 +09:00
<PostComponent {...this.data.post} />
)
} else {
return <p>Loading</p>
}
}
2016-02-16 15:08:30 +09:00
});
module.exports = PostContainer;