Last active
August 30, 2016 12:25
-
-
Save nicolaslopezj/e06be7edba8b7300274220a02492722d to your computer and use it in GitHub Desktop.
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
import {Meteor} from 'meteor/meteor' | |
import {withData} from 'meteor/orionsoft:react-meteor-data' | |
import MyCollection from './my-collection' | |
@withData(({itemId}) => { | |
const handler = Meteor.subscribe('myPublication', itemId) | |
const isLoading = !handler.ready() | |
const item = MyCollection.findOne(itemId) | |
return {isLoading, item} | |
}) | |
export default class Component extends React.Component { | |
render () { | |
if (this.props.isLoading) return <span/> | |
return ( | |
<div> | |
{this.props.item.name} | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment